Skip to content
Browse files

added collection.findAndModify

  • Loading branch information...
1 parent 07b2081 commit 9dd3166409e23e10f3bd774aed97e5aa6e3cb104 @marcello3d committed Apr 29, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/collection.js
View
15 lib/collection.js
@@ -227,7 +227,6 @@ MongolianCollection.prototype.mapReduce = function(mapFunction, reduceFunction,
}
function MapReduceResult(db, result) {
- console.log("result",result)
if (result.results) this.results = result.results
this.timeMillis = result.timeMillis
this.counts = result.counts
@@ -242,6 +241,20 @@ MapReduceResult.prototype.drop = function(){
this.collection && this.collection.drop()
}
+/**
+ *
+ */
+MongolianCollection.prototype.findAndModify = function(options, callback) {
+ var command = {
+ findandmodify:this.name
+ }
+ for (var key in options) command[key] = options[key]
+ this.db.queryCommand(command, safetyNet(callback, function(result) {
+ callback(null, result.value)
+ }))
+}
+
+
MongolianCollection.prototype.toString = function() {
return this.db + "." + this.name
}

0 comments on commit 9dd3166

Please sign in to comment.
Something went wrong with that request. Please try again.