_id
in client side, isn't it required to check its uniqueness in my collection? I supposed that check is more expensive than type casting in server side, what do you think? Monthly Archives: دی 1392
How to convert a string to ObjectId in nodejs mongodb native driver?
Salam (means hello) :)
I'm using mongodb native driver in a nodejs environment and I need to convert an id string to ObjectId to use it in my update query, how can I do this?
Comment by Nasser Torabzade on How to check if a collection exists in Mongodb native nodejs driver?
db.collection('system.namespaces').find().toArray(function(err, items) {})
Comment by Nasser Torabzade on How to check if a collection exists in Mongodb native nodejs driver?
db.collection('system.namespaces').find().toArray(function(err, items) {})
Comment by Nasser Torabzade on How to check if a collection exists in Mongodb native nodejs driver?
db.collection('system.namespaces').find().toArray(function(err, items) {})
Comment by Nasser Torabzade on How to check if a collection exists in nodejs native driver?
db.collection('system.namespaces').find().toArray(function(err, items) {})
Comment by Nasser Torabzade on How to check if a collection exists in Mongodb native nodejs driver?
How to check if a collection exists in Mongodb native nodejs driver?
I need to check if a collection exists on a certain database and create it if it doesn't. I know that
db.createCollection(collName, {strict:true}, function(error, collection))
checks for existance of collection collName
before creating it and sets error
object. but I need an independent function to check that.
Comment by Nasser Torabzade on How to check if a collection exists in Mongodb native nodejs driver?
Comment by Nasser Torabzade on How to check if a collection exists in nodejs native driver?
How to check if a collection exists in nodejs native driver?
Salam (means Hello) :)
I need to check if a collection exists on a certain database and create it if it doesn't. I know that
db.createCollection(collName, {strict:true}, function(error, collection))
checks for existance of collection collName
before creating it and sets error
object. but I need an independent function to check that.
Comment by Nasser Torabzade on How to update multiple documents in mongodb native nodejs driver?
Comment by Nasser Torabzade on How to update multiple documents in mongodb native nodejs driver?
Comment by Nasser Torabzade on How to update multiple documents in mongodb native nodejs driver?
How to update multiple documents in mongodb native nodejs driver?
Salam (means hello) :)
I'm running mongodb 2.4.8 and Mongo DB Native NodeJS Driver. when I use the following function, only first document that matched query
updates. how can I update all matching documents?
function update(coll, query, update, callback){
var options = options || {};
MongoClient.connect('mongodb://127.0.0.1:27017/dbName', function(error, db) {
if(error){
return console.dir(error);
}
db.collection(coll).update(query, update, {w:1}, function(error, result) {
callback(error, result);
});
});
}
I installed my mongodb driver via npm install mongodb
command, which installs version 1.3.23
, does this driver version support multi update? if not, how can I install a newer version of driver supports multi update?