What's the reasonable array list limit for MongoDB?

I’m adding every word of text or hashtags to array list. What’s the logical limit for mongo arrays? How many objects should i add max?

My array is indexed. And only have one array field per object.

From the docs:

Parse Objects are limited in size to 128 KB.

In addition, the general limits of MongoDB BSON documents apply.

Edit: The object size limitation has been removed in Parse open source.

1 Like

Hi @Manuel. Thank you. But Can bigger array list decrease performance? I mean 10 object array and 1000 object array. does query performance is same? when they are indexed?

It depends on which performance you look at, object size always have some kind of performance implication, just to mention a few:

  • Your MongoDB collection will grow, which is likely to increase your working set size, which will make your DB use more RAM, unless you go deep into MongoDB and use smart indexing and queries to counter that.
  • Network traffic will increase which can be a significant cost factor, unless you can often exclude the keys you don’t need from the query, see the select command in the Parse SDKs.
  • In Parse Server, the de-/serialization from JSON to Parse objects take longer for large objects, this process is known to already have a significant performance impact, see this, so a larger object size is likely to increase that, but I don’t know if the increase is O(N) or more.
  • If you send the whole object to the client, there is obviously another performance implication on the client side, including the data traffic for the user which can be an issue in developing countries where network data is still costly.
1 Like

My objects are generally smaller than 2KB. Is this ok?

@Manuel in open source version of parse, the limit of 128KB on Parse Object no longer exists. But I totally agree with you, having big objects will lead to massive issue on query/network performance.

@uzaysan, if you array will contain 1 to X objects depending of a user input in 99% of the time you should switch it to a Relation style.

An exception could be to use an hidden array ( never retreived to final user via exclude option ) for some smart meta searching engine needs ( I already used this type of array with 100 elements into the array for powerful text searching on a Parse Object )

1 Like

To minimize bandwidth exchange on both user and backend size, using the GraphQL API is a good option since GraphQL optimize and only retrieve needed fields. We also added on the backend implementation some optimization to only extract from the database needed fields for the query response: so a win for your users and a a win for you ( performance and less network traffic )

Uh, that totally missed my radar, but thanks for correcting, it’s still all over the docs, I will open a PR.

1 Like

Omg. That’s what I’m doing right now. Except i didn’t use exclude option but i will use it from now. Glad to hear that I’m in the right path.