Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MongoDB in quantity limit

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. The query statement itself is actually a document, with a maximum of 16MB (3.4, official documentation)

2. The query statement itself, that is, {': {'$in': []}}, has a size of 22 bytes

3. Add one byte for each additional field name

4. For each additional parameter in the in, the size increases by 11 bytes.

5. As follows:

Mongos > Object.bsonsize ([1])

sixteen

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4]}})

seventy-four

Mongos > Object.bsonsize ({'fieldOne': {$in: [1, 2, 3, 4, 5]})

eighty-five

Mongos > Object.bsonsize ({'fieldOne': {$in: [1, 2, 3, 4, 5, 6]})

ninety-six

Mongos > Object.bsonsize ({'fieldOne': {$in: [1, 2, 3, 4, 5, 6, 69000]}})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1, 2, 3, 4, 5, 6, 6900000]}})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4,5,6,69000000000]})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4,5,6,69000000000000]})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4,5,6,6900000000000000]})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4,5,6,690000000000000000]})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4,5,6,69000000000000000000]})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4,5,6,690000000000000000000000]})

one hundred and seven

Mongos > Object.bsonsize ({'fieldOne': {$in: [1,2,3,4,5,6,690000000000000000000000000000]})

one hundred and seven

No matter how big the number is, the bytes are the same.

Mongos > Object.bsonsize ({'a': {'$in': [1]}})

thirty-four

Mongos > Object.bsonsize ({'': {'$in': [1]}})

thirty-three

Mongos > Object.bsonsize ({'': {'$in': []}})

twenty-two

The query document itself is 22 bytes

Each byte of the field name adds a single byte

Each number added to the $in clause adds 11 bytes.

Mongos > 16 "1024" 1024

16777216

Mongos > (16,1024,1024)-22-1

16777193

Mongos > (16,1024,1024)-22-1) / 11

1525199.3636363635

THE ANSWER: 1525198 (That's 1.5 million. That's pretty big.)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 218

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report