Answer the question
In order to leave comments, you need to log in
MongoDB doesn't give me all the documents I request. What's the problem?
There are 2 million documents in my database. Each document in my database has a separate id field which is numbered from 1 to the last document.
Also, each document has a data field which is an array of dictionaries. I need to find all documents, the first dictionary of the data field has a field with a value in my specified range (from 100 to 150 for example).
I send a request to the database {"data.0.value":{$gte:100, $lte:150}}, and the joke is that mongo does not give me all the documents.
I understood this by sorting the results and looking at the id of the very first document, and for some reason it starts with 200000 id. Although before that id there were documents with value lying in the range that we need. Please help me understand why this is happening.
Answer the question
In order to leave comments, you need to log in
hmm strange, but if you try to paint the request in more detail like this?
$and: [
{"data.0.value": { $gte:100 } },
{"data.0.value" :{ $lte:150 } }
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question