More than 20K key and value pair

We are collecting a that when translated into a JSON object, this will contain more than 20K key and value pairs. Is this something that MongoDB can handle?

There is a document size limit of 16 MB.
Documents — MongoDB Manual

If every key has its double value, then your document size will approximately be 350 kB. I recommend setting indexes as queries with such large documents will run very slowly.

Welcome to the MongoDB Community @Rommel_Oli !

If you are inserting JSON documents as-is, the limitations for individual documents are:

  • Maximum BSON document size (MongoDB binary representation) of 16MB
  • No more than 100 levels of nesting

Depending on your use case, there may be better ways to model this data in MongoDB. For example, 20k fields which are infrequently used could lead to anti-patterns like Bloated Documents.

Some recommended references are