| As a simple example, running the following script alongside mongotop will show no increase in top statistics:
db.toptest.insert({a:1});
|
for (var i = 0; i < 100000; i++) {
|
db.toptest.findAndModify({
|
query:{a:{$gt:0}},
|
update:{$inc:{a:1}}
|
});
|
}
|
mongotop will consistently show
ns total read write 2016-06-08T09:59:48-04:00
test.toptest 0ms 0ms 0ms
Meanwhile, running the similar script with update instead shows an increase in top statistics:
for (var i = 0; i < 100000; i++) {
|
db.toptest.update({a:{$gt:0}}, {$inc:{a:1}});
|
}
|
ns total read write 2016-06-08T10:04:47-04:00
test.toptest 197ms 0ms 197ms
|