Answer the question
In order to leave comments, you need to log in
How to optimize MongoDB?
I don't understand what the problem is. There is a small collection, let's say 50 such documents:
db.test.insert({a: 1, b: 'test', c: 'test'});
db.test.insert({a: 2, b: 'test', c: 'test'});
db.test.insert({a: 3, b: 'test', c: 'test'});
db.test.insert({a: 4, b: 'test', c: 'test'});
db.test.insert({a: 5, b: 'test', c: 'test'});
...
db.test.update({a: {$in: [1,2,3]}}, {$set: {d: [0...1000000]}});
db.test.find({}, {a: 1, b: 1});
db.test.find({}, {d: 0});
db.test.find({a: 5});
db.test.find({a: 5}, {a: 1, b: 1});
db.test.find({a: {$in: [4,5]}});
db.test.find({a: {$in: [4,5]}}, {a: 1, b: 1});
db.test.find({a: {$in: [4,5]}}, {d: 0});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question