How to use the mongodb.Collection.prototype function in mongodb

To help you get started, we’ve selected a few mongodb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bfrgoncalves / Online-PhyloViZ / node_modules / mongoose / lib / drivers / node-mongodb-native / collection.js View on Github external
// See gh-3906
      if (args.length > 0 &&
          typeof args[args.length - 1] === 'function') {
        args[args.length - 1](error);
      } else {
        throw error;
      }
    }
  };
}

for (var i in Collection.prototype) {
  // Janky hack to work around gh-3005 until we can get rid of the mongoose
  // collection abstraction
  try {
    if (typeof Collection.prototype[i] !== 'function') {
      continue;
    }
  } catch (e) {
    continue;
  }

  iter(i);
}

/**
 * Debug print helper
 *
 * @api public
 * @method $print
 */
github didinj / node-express-mongoose-passport-jwt-rest-api-auth / node_modules / mongoose / lib / drivers / node-mongodb-native / collection.js View on Github external
try {
      return collection[i].apply(collection, args);
    } catch (error) {
      // Collection operation may throw because of max bson size, catch it here
      // See gh-3906
      if (args.length > 0 &&
          typeof args[args.length - 1] === 'function') {
        args[args.length - 1](error);
      } else {
        throw error;
      }
    }
  };
}

for (const i in Collection.prototype) {
  // Janky hack to work around gh-3005 until we can get rid of the mongoose
  // collection abstraction
  try {
    if (typeof Collection.prototype[i] !== 'function') {
      continue;
    }
  } catch (e) {
    continue;
  }

  iter(i);
}

/**
 * Debug print helper
 *
github dinubs / jam-api / node_modules / mongoose / lib / drivers / node-mongodb-native / collection.js View on Github external
/**
 * Called when the connection closes
 *
 * @api private
 */

NativeCollection.prototype.onClose = function() {
  MongooseCollection.prototype.onClose.call(this);
};

/*!
 * Copy the collection methods and make them subject to queues
 */

for (var i in Collection.prototype) {
  // Janky hack to work around gh-3005 until we can get rid of the mongoose
  // collection abstraction
  try {
    if (typeof Collection.prototype[i] !== 'function') {
      continue;
    }
  } catch (e) {
    continue;
  }

  (function(i) {
    NativeCollection.prototype[i] = function() {
      if (this.buffer) {
        this.addQueue(i, arguments);
        return;
      }
github onehilltech / blueprint / packages / blueprint-gatekeeper / src / server / node_modules / mongoose / lib / drivers / node-mongodb-native / collection.js View on Github external
/**
 * Called when the connection closes
 *
 * @api private
 */

NativeCollection.prototype.onClose = function () {
  MongooseCollection.prototype.onClose.call(this);
};

/*!
 * Copy the collection methods and make them subject to queues
 */

for (var i in Collection.prototype) {
  // Janky hack to work around gh-3005 until we can get rid of the mongoose
  // collection abstraction
  try {
    if (typeof Collection.prototype[i] !== 'function') {
      continue;
    }
  } catch(e) {
    continue;
  }

  (function(i){
    NativeCollection.prototype[i] = function () {
      if (this.buffer) {
        this.addQueue(i, arguments);
        return;
      }
github sx1989827 / DOClever / node_modules / mongoose / lib / drivers / node-mongodb-native / collection.js View on Github external
// See gh-3906
      if (args.length > 0 &&
          typeof args[args.length - 1] === 'function') {
        args[args.length - 1](error);
      } else {
        throw error;
      }
    }
  };
}

for (var i in Collection.prototype) {
  // Janky hack to work around gh-3005 until we can get rid of the mongoose
  // collection abstraction
  try {
    if (typeof Collection.prototype[i] !== 'function') {
      continue;
    }
  } catch (e) {
    continue;
  }

  iter(i);
}

/**
 * Debug print helper
 *
 * @api public
 * @method $print
 */
github dinubs / jam-api / node_modules / mongoose / lib / drivers / node-mongodb-native / collection.js View on Github external
* @api private
 */

NativeCollection.prototype.onClose = function() {
  MongooseCollection.prototype.onClose.call(this);
};

/*!
 * Copy the collection methods and make them subject to queues
 */

for (var i in Collection.prototype) {
  // Janky hack to work around gh-3005 until we can get rid of the mongoose
  // collection abstraction
  try {
    if (typeof Collection.prototype[i] !== 'function') {
      continue;
    }
  } catch (e) {
    continue;
  }

  (function(i) {
    NativeCollection.prototype[i] = function() {
      if (this.buffer) {
        this.addQueue(i, arguments);
        return;
      }

      var collection = this.collection,
          args = arguments,
          self = this,
github joshlobaptista / Barista-Fullstack / node_modules / mongoose / lib / drivers / node-mongodb-native / collection.js View on Github external
try {
      return collection[i].apply(collection, args);
    } catch (error) {
      // Collection operation may throw because of max bson size, catch it here
      // See gh-3906
      if (args.length > 0 &&
          typeof args[args.length - 1] === 'function') {
        args[args.length - 1](error);
      } else {
        throw error;
      }
    }
  };
}

for (var i in Collection.prototype) {
  // Janky hack to work around gh-3005 until we can get rid of the mongoose
  // collection abstraction
  try {
    if (typeof Collection.prototype[i] !== 'function') {
      continue;
    }
  } catch (e) {
    continue;
  }

  iter(i);
}

/**
 * Debug print helper
 *
github 2do2go / mongodbext / lib / collection.js View on Github external
meta: meta,
				result: nativeResult
			};

			self.trigger('afterUpdateOne', [afterHookParams], function(err) {
				if (err) {
					return triggerErrorHook(err, callback);
				}

				callback(
					null, isReturnDocsOnly && !err ? updateResult.value : updateResult
				);
			});
		};

		SourceCollection.prototype.findOneAndUpdate.call(
			self, filter, update, options, sourceCallback
		);
	});
};
github 2do2go / mongodbext / lib / mongodbext.js View on Github external
afterHookParams = {
					condition: filter,
					replacement: update,
					options: options,
					result: nativeResult
				};
			self.trigger('afterReplaceOne', [afterHookParams], function(err) {
				if (err) {
					return triggerErrorHook(err, callback);
				}

				callback(err, isReturnResultOnly ? nativeResult : replaceResult);
			});
		};

		SourceCollection.prototype.replaceOne.call(
			self, filter, update, options, sourceReplaceCallback
		);
	});
};
github 2do2go / mongodbext / lib / collection / update.js View on Github external
meta: meta,
					result: nativeResult
				};

				self.trigger(afterHookName, [afterHookParams], function(err) {
					if (err) {
						return triggerErrorHook(err, callback);
					}

					callback(
						null, isReturnResultOnly ? nativeResult : updateResult
					);
				});
			};

			SourceCollection.prototype[methodName].call(
				self, filter, update, options, sourceUpdateCallback
			);
		});
	});