2014년 12월 6일 토요일

mysql have a setting max_allowed_packet, whether have similar setting in mongodb about network?

as subject.



For example:

db.collection.find({
    $or: [
        {},
        {},
        {},
        {},
        .
        .
        .
        .
    ]
})

it is have more condition, so i want to ask whether have similar limits in mongodb.



For example:

db.collection.find({
    $or: [
...
 
   ]
})

it is have more condition, so i want to ask whether have similar limits in mongodb.

Hi,

MongoDB does not have a similar setting to configure the maximum size of network packets that the server will accept. The MongoDB wire protocol and storage engine use BSON for message & document encoding, with a limit that is currently fixed at 16MB: http://docs.mongodb.org/manual/reference/limits/#bson-documents.

FYI, the general limits & thresholds for MongoDB are listed in the documentation: http://docs.mongodb.org/manual/reference/limits/.

You almost certainly would not want to have 16MB of $or clauses, though. There are probably better ways to address your search needs by adjusting the data model or perhaps using text search (http://docs.mongodb.org/manual/core/index-text/).

Can you provide a more specific example of a document and what might be in the $or clauses?



My document is :

{
    "_id" : "100000001",
    "thresholds" : {},
    "rateType" : "BeforeTax",
    "occupancyTax" : "0.00",
    "currencyCode" : "USD",
    "stateTax" : "0.14"
}

_id from 100000001 to 999999999

other property value is different

now, i want to find some data with assign _id, maybe more 10000 records, for example:

b.collection.find({
    $or: [ 
         {_id: "100000001"},
            {_id: "100000011"},  
          {_id: "100900001"},
   ]
})

assign _id no regular, so i want to know whether have some limits for clauses?



by my understand, if my clauses less than 16MB, it can work in mongodb?



by my understand, if my clauses less than 16MB, it can work in mongodb?

Yes, that's correct. If you are searching for a number of values you probably want to use an $in query (http://docs.mongodb.org/manual/reference/operator/query/in/) or a range-based query rather than multiple $or clauses.



Yes, we used to $in  instead of $or. thank you.


댓글 없음:

댓글 쓰기