Let's say I have a mongoDB database with 3 collections:

  • widgets
  • thingomajiggers
  • locations

The way the application is going to be used that I will always force the user to specify a location first. and then from there, they can drill down into the type object they are looking to read / create / update - namely either a widget or a thingomajigger.

So in this case, would it be better to have a separate location collection and refer to this collection from the documents in widgets and thingomajiggers, or should I embed location information right inside my widget / thingomajigger documents?

Currently my prototype is small so I can't imagine me really noticing performance differences. But eventually I will have hundreds of thousands of widgets and other object types.


1 Answer 1


I think I found my answer from the mongoDB manual:

In general, use embedded data models when:

  • you have “contains” relationships between entities. See Model One-to-One Relationships with Embedded Documents.
  • you have one-to-many relationships between entities. In these relationships the “many” or child documents always appear with or are viewed in the context of the “one” or parent documents. See Model One-to-Many Relationships with Embedded Documents.


The later scenario would apply to me.

Your Answer

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

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