Array of Pointers - How many is too many?

I’ve been using Parse for years and always read quote:

Arrays are ideal when we know that the number of objects involved in our one-to-many relationship are going to be small.

My question is, what is considered small? Are we talking less than 10, 100, 1000, 10000?

Bonus: if you can explain why and/or what happens when you exceed the recommended limit.

Thank you for your time!

First a limitation is the mongo document; it should not exceed 16Mb.

Another issue here will be fetch and update performance. You should pull and send to full array each time you want to save it. This will eat a lot of network.
1000 elements into a parse object array is not recommended.

If your array tend to grow as X, it’s a better choice to use relation field type here.

I’d not use arrays to store more than 20 elements and for sure nothing that you know will grow over time. I’ve seen many apps with bad performance issues because of this. When the document grows too much (even under MongoDB document limit), it makes the collection to be fragmented in the disk, causing any write operation in the document (not only in the array) to take a substantial amount of time. Since write operations lock the database, it makes a lot of other operations happening in the database at the same time to also delay.

2 Likes