Presuming I've an user that has an ID and I wish to store a historic record (document) about this user every single day, what's better:

  • produce a new document for every record and check for that user id or
  • keep upgrading and embedding that data into a single user document which will keep growing with time?

Mostly I wish to retrieve just the current document for that user but all records ought to be accessible anytime with no super lengthy search/query.

There's a restriction to how large a document could be. It's (by v1.8) 16 Megabytes. So that you can simply exhaust room should you update &lifier embed. Also, mongo allocates document space based normally document size inside a collection. Should you keep modifying/resizing this may have negative performance implications.

I believe it's much far better to create new documents for every record and when/when you wish to collate that data, you're doing so inside a map/reduce job.

You will find lots of variables that may affect this type of decision. One large document appears most apparent provided it does not grow to unpractically large as well as disallowed dimensions (actually, a document could be for the most part 16MB in dimensions).

Using document per entry can also be perfectly viable and provided you produce the appropriate indexes shouldn't lead to slow queries.