What is the maximum number of parameters passed to $in query in MongoDB? -


What are the maximum parameters that go to the query in MongoDB for $$?

query is a document MongoDB document size (version 2.4.0+ As opposed to 16 MB).

In fact, what are you doing with search:

  db.collectionName.find (queryDoc)   

QueryDoc 'is something like this:

  {' fieldOne ': {$ in: [1, 2, 3, 4]}}   

The number that you can pass in the query in $, use the bsonsize command:

  mangos> Object. Collaboration ([1]) 16 occasions & gt; Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4]}}) 74 occasions & gt; Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4, 5]}}) 85 Mogoes & gt; Object.bosignize (('FieldOn': {$ in: [1, 2, 3, 4, 5, 6]}}) 96   

So, you can see that each additional The integer size is 11 bytes 11 bits, 11 BYTES This is the way BSON is internally due to the number of stores, and the cover of at least 64 bits each. It can be easily seen:

  mangos> Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4, 5, 6, 69000]}}) 107 mojo> Object.bsonsize ( {'FieldOne': {$ in: [1, 2, 3, 4, 5, 6, 6900000]}}) 107 mojoes Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4, 5, 6, 69 billion, 000,000]} }) 107mongs> Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4, 5, 6, 6, 6, 9, 2000, 20000}}}) 107 mangoes> Object.bsonsize ({'fieldOne ': {$ In: [1, 2, 3, 4, 5, 6, 6, 9, 2000000000000000000}}}) 107 mojo Object.bsonsize ({' fieldOne ': {$ in: [1, 2, 3, 4 , 5, 6, 6, 9, 2000000000000000000}}} 107 occasions & gt; Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4, 5, 6, 6, 9, 20, 2000000000000000000]} }) 107 occasions & gt; Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4, 5, 6, 6, 9, 20,000,000,000,000,000,000,000,000,000}}}) 107 occasions & gt; Object.bsonsize ({'fieldOne': {$ in: [1, 2, 3, 4, 5, 6, 69 billion, 200000000000000000000000000}}} 107   

So, no matter what size

The question itself is: How big is the question that

add them to any one field query with $ in clause, in pimongo, mongus Whatever the JavaScript prompts, add the same additional facts for the maximum size of $ $ in all queries:

  mangos & gt; Object.bsonsize ({'a': {'$ in': [1]}} 34 mounts> Object.bsonsize ({':: {' $ in ': [1]}}) 33 occasions & gt;   
  • ($: '' $ In ': []}} 22 < Ul>
  • Adds $ 11 bytes to each dollar in the clause.

    Name is (minimum, in fact), your maximum is:

      Mongos> 16 * 1024 * 1024 16777216 Mongols> (16 * 1024 * 1024) - 22 - 1 16777193 Mangoes & Gt; (16 * 1024 * 1024) - 22 -1) / 11 1525199.3636363635   

    Answer: 1,525,198 (This is 1.5 million It's too big.)

  • Comments