690 shaares
3 liens privés
3 liens privés
Find by id :
db.test.find({"_id" : ObjectId("4ecc05e55dd98a436ddcc47c")})
Show all ids :
var a = db.c.find({}, {_id:1}).map(function(item){ return item._id; })
Run actions on elements :
tests.forEach(function(test) {
if (evaluation.hasOwnProperty('toto')) {
print('toto was here');
} else {
db.tests.save(test);
}
});
Run javascript :
load('/tmp/xxx.js');
Connect to database :
db = connect("mongodb://user:password@localhost:27017/lcri?authSource=admin");