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: "contact@store.com",
  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.


1 Answer 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.