mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Updated mongoose
This commit is contained in:
50
node_modules/mongoose/lib/collection.js
generated
vendored
50
node_modules/mongoose/lib/collection.js
generated
vendored
@ -3,7 +3,8 @@
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var STATES = require('./connectionstate')
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var STATES = require('./connectionstate');
|
||||
|
||||
/**
|
||||
* Abstract Collection constructor
|
||||
@ -16,7 +17,7 @@ var STATES = require('./connectionstate')
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function Collection (name, conn, opts) {
|
||||
function Collection(name, conn, opts) {
|
||||
if (undefined === opts) opts = {};
|
||||
if (undefined === opts.capped) opts.capped = {};
|
||||
|
||||
@ -30,14 +31,16 @@ function Collection (name, conn, opts) {
|
||||
|
||||
this.opts = opts;
|
||||
this.name = name;
|
||||
this.collectionName = name;
|
||||
this.conn = conn;
|
||||
this.queue = [];
|
||||
this.buffer = this.opts.bufferCommands;
|
||||
this.emitter = new EventEmitter();
|
||||
|
||||
if (STATES.connected == this.conn.readyState) {
|
||||
this.onOpen();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The collection name
|
||||
@ -48,6 +51,15 @@ function Collection (name, conn, opts) {
|
||||
|
||||
Collection.prototype.name;
|
||||
|
||||
/**
|
||||
* The collection name
|
||||
*
|
||||
* @api public
|
||||
* @property collectionName
|
||||
*/
|
||||
|
||||
Collection.prototype.collectionName;
|
||||
|
||||
/**
|
||||
* The Connection instance
|
||||
*
|
||||
@ -63,7 +75,7 @@ Collection.prototype.conn;
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Collection.prototype.onOpen = function () {
|
||||
Collection.prototype.onOpen = function() {
|
||||
var self = this;
|
||||
this.buffer = false;
|
||||
self.doQueue();
|
||||
@ -75,7 +87,7 @@ Collection.prototype.onOpen = function () {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Collection.prototype.onClose = function () {
|
||||
Collection.prototype.onClose = function() {
|
||||
if (this.opts.bufferCommands) {
|
||||
this.buffer = true;
|
||||
}
|
||||
@ -90,7 +102,7 @@ Collection.prototype.onClose = function () {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Collection.prototype.addQueue = function (name, args) {
|
||||
Collection.prototype.addQueue = function(name, args) {
|
||||
this.queue.push([name, args]);
|
||||
return this;
|
||||
};
|
||||
@ -101,11 +113,15 @@ Collection.prototype.addQueue = function (name, args) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Collection.prototype.doQueue = function () {
|
||||
for (var i = 0, l = this.queue.length; i < l; i++){
|
||||
Collection.prototype.doQueue = function() {
|
||||
for (var i = 0, l = this.queue.length; i < l; i++) {
|
||||
this[this.queue[i][0]].apply(this, this.queue[i][1]);
|
||||
}
|
||||
this.queue = [];
|
||||
var _this = this;
|
||||
process.nextTick(function() {
|
||||
_this.emitter.emit('queue');
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -113,7 +129,7 @@ Collection.prototype.doQueue = function () {
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.ensureIndex = function(){
|
||||
Collection.prototype.ensureIndex = function() {
|
||||
throw new Error('Collection#ensureIndex unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -121,7 +137,7 @@ Collection.prototype.ensureIndex = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.findAndModify = function(){
|
||||
Collection.prototype.findAndModify = function() {
|
||||
throw new Error('Collection#findAndModify unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -129,7 +145,7 @@ Collection.prototype.findAndModify = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.findOne = function(){
|
||||
Collection.prototype.findOne = function() {
|
||||
throw new Error('Collection#findOne unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -137,7 +153,7 @@ Collection.prototype.findOne = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.find = function(){
|
||||
Collection.prototype.find = function() {
|
||||
throw new Error('Collection#find unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -145,7 +161,7 @@ Collection.prototype.find = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.insert = function(){
|
||||
Collection.prototype.insert = function() {
|
||||
throw new Error('Collection#insert unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -153,7 +169,7 @@ Collection.prototype.insert = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.save = function(){
|
||||
Collection.prototype.save = function() {
|
||||
throw new Error('Collection#save unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -161,7 +177,7 @@ Collection.prototype.save = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.update = function(){
|
||||
Collection.prototype.update = function() {
|
||||
throw new Error('Collection#update unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -169,7 +185,7 @@ Collection.prototype.update = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.getIndexes = function(){
|
||||
Collection.prototype.getIndexes = function() {
|
||||
throw new Error('Collection#getIndexes unimplemented by driver');
|
||||
};
|
||||
|
||||
@ -177,7 +193,7 @@ Collection.prototype.getIndexes = function(){
|
||||
* Abstract method that drivers must implement.
|
||||
*/
|
||||
|
||||
Collection.prototype.mapReduce = function(){
|
||||
Collection.prototype.mapReduce = function() {
|
||||
throw new Error('Collection#mapReduce unimplemented by driver');
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user