Answer the question
In order to leave comments, you need to log in
How to search through a collection?
In the collection there are documents of the form {_id: id, "custom-field": true} or just {_id: id}
Do I correctly select all values where custom-field = true, or it does not exist at all.
db.collection.find({"custom-field": {$in: [true]}}) - When you need to select documents where there is custom-field = true
db.collection.find({"custom-field": { $nin: [true]}}) - All other documents where custom-field is absent or false
One more question: I heard that skip in mongodb is not very fast, is it? I will need to iterate over a collection with 20 million documents, I think to select them by 1000 and skip or is this a bad idea? Or if I select 20KK documents at once and put them into an array, then if there is RAM, everything will work well? Or is it not worth it at all?
Answer the question
In order to leave comments, you need to log in
db.collection.find({"custom-field": {$in: [true]}})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question