Skip to content
This repository
Browse code

added collection.findAndModify

  • Loading branch information...
commit 9dd3166409e23e10f3bd774aed97e5aa6e3cb104 1 parent 07b2081
Marcello Bastéa-Forte authored

Showing 1 changed file with 14 additions and 1 deletion. Show diff stats Hide diff stats

  1. +14 1 lib/collection.js
15 lib/collection.js
@@ -227,7 +227,6 @@ MongolianCollection.prototype.mapReduce = function(mapFunction, reduceFunction,
227 227 }
228 228
229 229 function MapReduceResult(db, result) {
230   - console.log("result",result)
231 230 if (result.results) this.results = result.results
232 231 this.timeMillis = result.timeMillis
233 232 this.counts = result.counts
@@ -242,6 +241,20 @@ MapReduceResult.prototype.drop = function(){
242 241 this.collection && this.collection.drop()
243 242 }
244 243
  244 +/**
  245 + *
  246 + */
  247 +MongolianCollection.prototype.findAndModify = function(options, callback) {
  248 + var command = {
  249 + findandmodify:this.name
  250 + }
  251 + for (var key in options) command[key] = options[key]
  252 + this.db.queryCommand(command, safetyNet(callback, function(result) {
  253 + callback(null, result.value)
  254 + }))
  255 +}
  256 +
  257 +
245 258 MongolianCollection.prototype.toString = function() {
246 259 return this.db + "." + this.name
247 260 }

0 comments on commit 9dd3166

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