More Related Content
Similar to Utilisation de node.js avec mongoDB
Similar to Utilisation de node.js avec mongoDB (20)
Utilisation de node.js avec mongoDB
- 2. Juillet 2010 Webworkers camp à la Cantine – Paris -découverte de node.js et de mongoDB http://lacantine.ubicast.eu/channels/web-workers-camp/
- 17. Le driver node-mongodb-native : dbmongo. open (function(err, dbmongo) { dbmongo. collection ("foo", treatCollection); }); var treatCollection= function(err,myCollection) { // Erase all records from the collection, if any myCollection. remove (function(err, myCollection) { // Insert records for(var i = 0; i < 3; i++) { myCollection. insert ({"bar":i}); } // find records greater than 0 myCollection. find ({ "bar" : { $gt: 0 } },function(err, cursor) { cursor.each(function(err, item) { if(item !== null) { sys.puts(sys.inspect(item)); } // Null means end of iterator if(item === null) { dbmongo. close (); } }); }); }); };