2

I have searched extensively for a similar Mongo schema design and can't find relevant examples.

I have a store (with public info), each store has an account (with private account info).

// store object
{
 name: "Departement Store",
 email: "[email protected]",
 account: { // private info not returned by API
 manager: "Steve",
 employees: [...]
 }
}

The stores will be searched through a public API. I am limiting the search queries using MongoDB's features to limit the returned data:

db.stores.find({}, {account:0});

My question: is it more efficient to keep the private data as a subdocument or in a separate collection? It seems a separate collection with account info is the best choice as I will be picking and choosing from an embedded document.

References:

asked Sep 12, 2014 at 3:22

1 Answer 1

1

As an update, this question was answered here: https://groups.google.com/forum/#!topic/mongodb-user/-1eXvkoxHUw

Summary: Keep data in one document, restrict data using MongoDB's built-in projection feature.

answered Apr 14, 2015 at 0:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.