Reputation: 161
I'm working on a scheme that will heavily use array fields in mongo documents, are there any known problems with the approach of holding rather large arrays of other documents etc?
performance issues?
being rather new to mongo and coming from SQL background the approach seems "out of place" for me since it's bit different than the approach of grouping all records in a table by a set of "primary keys" instead of holding the "primary keys" once and holding the rest of the data in arrays.
the "primary keys" approach is my other option to use in mongo as well
what is best?
Upvotes: 1
Views: 161
Reputation: 1506
I'm not aware of special performance issues. What you need to keep in mind is that you have only about 16mb at most for one document. So if you have several hundred or thousand subdocs, with some reasonal length you may come into trouble with the document limit. Depending on the fact how often you need those subdocs and your primary docs, you may consider to split it. Else your primary doc will have much overload (your subdocs), blocking other "business objects" to be kept in RAM. So this may be a point.
Additionally without that I worked with Arrays much actual, it may be wise to use only primary keys, if those subdocs may be displayed/queried over all those subdocs, without their parents needed. I think it highly depends upon the fact if you need those subdocs separately and often.
What is best, is a question of your use case, nothing in general :)
Upvotes: 1