Permalink
Browse files

add update example

  • Loading branch information...
guileen committed Apr 5, 2012
1 parent cec5c68 commit ed173837a5740d615cbbade6d32cdb7bbb41614b
Showing with 20 additions and 0 deletions.
  1. +20 −0 examples/update.js
View
@@ -0,0 +1,20 @@
+var db = require('./config').db;
+var articles = db.collection('articles');
+articles.insert({foo: 'bar', val: 'val1'}, function(err, result) {
+
+ console.log(result);
+ articles.update({foo:'bar'}, {foo: 'bar', val:'val2'}, function(err, result) {
+
+ console.log(result);
+ articles.find({foo: 'bar'}).toArray(function(err, docs){
+
+ console.log(docs);
+ db.close(function() {
+ console.log('connection closed');
+ });
+
+ });
+
+ })
+
+});

0 comments on commit ed17383

Please sign in to comment.