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: