Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

p-odm

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-odm - npm Package Compare versions

Comparing version 3.0.7 to 3.0.8

examples/Person.js

30

examples/simple.js

@@ -8,28 +8,14 @@ 'use strict';

// Address, to be embedded on Person
var Address = odm.model({
"id": "Simple#Address",
"type" : "object",
"properties": {
"lines": {
"type": "array",
"items": {"type": "string"}
},
"zip": {"type": "string"},
"city": {"type": "string"},
"country": {"type": "string"}
/** @type {Person} */
var Person = require('./Person');
Person.findOne({name: 'me'}, function (error, person) {
if (error) {
console.error(error);
}
});
// Person model
var Person = odm.model("persons", {
"type" : "object",
"properties": {
"name": {"type": "string"},
"address": {"$ref": "Simple#Address"}
}
person.findMe();
});
// Tell that we're embedding Address as address on the person model
Person.embeds('address', Address);
Person.findMe();

@@ -36,0 +22,0 @@ // Create a new person

@@ -200,14 +200,24 @@ 'use strict';

/**
* @param {Object} query
* @param {Array} array
* @return {Number}
*/
function indexOf(query, array) {
var i, lenI;
for (i = 0, lenI = array.length; i < lenI; i++) {
if (matches(query, array[i])) {
return i;
if (Array.isArray(array)) {
var i, lenI;
for (i = 0, lenI = array.length; i < lenI; i++) {
if (matches(query, array[i])) {
return i;
}
}
}
return -1;
}
/**
* @param {Object} query
* @param {Array} array
* @return {*}
*/
function findOne(query, array) {

@@ -225,2 +235,7 @@ if (Array.isArray(array)) {

/**
* @param {ObjectID|String} id
* @param {Array} array
* @return {*}
*/
function findById(id, array) {

@@ -253,2 +268,7 @@ if (Array.isArray(array)) {

/**
* @param {Object} query
* @param {Array} array
* @return {Array}
*/
function find(query, array) {

@@ -268,2 +288,7 @@ if (Array.isArray(array)) {

/**
* @param {Object} query
* @param {Array} array
* @return {Number}
*/
function remove(query, array) {

@@ -286,2 +311,7 @@ if (Array.isArray(array)) {

/**
* @param {*} val
* @param {Array} array
* @return {Number}
*/
function simpleIndexOf(val, array) {

@@ -303,2 +333,7 @@ if (Array.isArray(array)) {

/**
* @param {*} val
* @param {Array} array
* @return {*}
*/
function simpleFindOne(val, array) {

@@ -320,2 +355,7 @@ if (Array.isArray(array)) {

/**
* @param {*} val
* @param {Array} array
* @return {Array}
*/
function simpleFind(val, array) {

@@ -338,2 +378,7 @@ if (Array.isArray(array)) {

/**
* @param {*} val
* @param {Array} array
* @return {Number}
*/
function simpleRemove(val, array) {

@@ -340,0 +385,0 @@ if (Array.isArray(array)) {

@@ -6,4 +6,9 @@ 'use strict';

var Binary = mongodb.BSONPure.Binary;
var Cursor = mongodb.Cursor;
var arrayHelper = require('./helpers/arrays');
var baseModel = require('./protos/freemodel');
var schemaModel = require('./protos/schemamodel');
var embedSchemaModel = require('./protos/embedschemamodel');
var Validator = require('jsonschema');

@@ -236,3 +241,7 @@

if (wantCursor) {
return callback(null, cursor);
if (cursor.state !== Cursor.CLOSED) {
return callback(null, cursor);
} else {
return callback('Cursor is closed');
}
}

@@ -298,10 +307,59 @@

* @memberOf ODM
* @param {String} [mongoCollection] Collection name, if not present this is an embedded document
* @param {Object} schema
* @param {Object} schemaDef
*
* @return {Model}
*/
model: require('./model'),
embeddedModel: function (schemaDef) {
var odm = this;
if (schemaDef !== undefined && schemaDef !== null) {
return embedSchemaModel(odm, schemaDef);
}
throw new Error('Cannot instantiate model without schema and collection');
},
/**
* Creates a new Document Model class
*
* @memberOf ODM
* @param {String} mongoCollection Collection name, if not present this is an embedded document
*
* @return {Function}
*/
basicModel: function (mongoCollection) {
var odm = this;
if (mongoCollection !== undefined) {
return baseModel(odm, mongoCollection);
}
throw new Error('Cannot instantiate model without schema and collection');
},
/**
* Creates a new Document Model class
*
* @memberOf ODM
* @param {String} mongoCollection Collection name, if not present this is an embedded document
* @param {Object|String} schemaDef
*
* @return {Function}
*/
schemaModel: function (mongoCollection, schemaDef) {
var odm = this;
if (schemaDef !== undefined && schemaDef !== null) {
if (mongoCollection !== undefined) {
return schemaModel(odm, mongoCollection, schemaDef);
}
}
throw new Error('Cannot instantiate model without schema and collection');
},
/**
* Helper functions to work with arrays

@@ -308,0 +366,0 @@ */

@@ -10,4 +10,6 @@ 'use strict';

var PROTO = '__proto__';
/**
* Creates a new Document Model class
* Creates a new Document EmbeddedModel class
*

@@ -18,3 +20,3 @@ * @memberOf ODM

*
* @return {Model}
* @return {Function}
*/

@@ -24,8 +26,8 @@ module.exports = function (odm, schemaDef) {

/**
* @name Model
* @class Document Model Customized class for a mongodb document schema.
* @name EmbeddedModel
* @class Document EmbeddedModel Customized class for a mongodb document schema.
* @param {Object} [json] if provided will update the current instance with the json properties
*/
var Model = function (json) {
if (this instanceof Model) {
var EmbeddedModel = function (json) {
if (this !== undefined && this instanceof EmbeddedModel) {
// new instance

@@ -43,3 +45,3 @@ if (json !== undefined && json !== null) {

if (json !== undefined && json !== null) {
json.__proto__ = Model.prototype;
json[PROTO] = EmbeddedModel.prototype;
}

@@ -53,5 +55,5 @@ return json;

*
* @memberOf Model
* @memberOf EmbeddedModel
*/
Object.defineProperty(Model, '$schema', {value: odm.createSchema(schemaDef)});
Object.defineProperty(EmbeddedModel, '$schema', {value: odm.createSchema(schemaDef)});

@@ -61,3 +63,3 @@ /**

*/
Object.defineProperty(Model, '$embeds', {value: []});
Object.defineProperty(EmbeddedModel, '$embeds', {value: {}});

@@ -70,4 +72,4 @@ /**

*/
Model.prototype.validate = function (verbose) {
var validation = odm.validate(this, Model.$schema);
EmbeddedModel.prototype.validate = function (verbose) {
var validation = odm.validate(this, EmbeddedModel.$schema);
if (Array.isArray(validation)) {

@@ -96,3 +98,3 @@ if (validation.length > 0) {

*/
Model.prototype.isValid = function () {
EmbeddedModel.prototype.isValid = function () {
return this.validate();

@@ -103,10 +105,11 @@ };

* Clones the Type prototype to this model class
* @deprecated
* @param path {String} Path to be updated
* @param type {Object} Type prototype to be copied
*/
Model.embeds = function (path, type) {
Model.$embeds.push({path: path, type: type});
EmbeddedModel.embeds = function (path, type) {
EmbeddedModel.$embeds[path] = type;
};
return Model;
return EmbeddedModel;
};

@@ -14,34 +14,11 @@ 'use strict';

var objectIdRegExp = /^[0-9a-fA-F]{24}$/;
var common = require('./common');
/**
* Extracts one option from the object and returns it.
* @private
*/
function extractOption(name, options, defaultValue) {
var option = defaultValue;
if (options) {
if (options.hasOwnProperty(name)) {
option = options[name];
delete options[name];
}
}
return option;
}
var extractOption = common.extractOption;
var getOption = common.getOption;
/**
* Gets one option from the object and returns it.
* @private
*/
function getOption(name, options, defaultValue) {
var option = defaultValue;
if (options) {
if (options.hasOwnProperty(name)) {
option = options[name];
}
}
return option;
}
var PROTO = '__proto__';
/**
* Creates a new Document Model class
* Creates a new BaseModel class
*

@@ -51,3 +28,3 @@ * @param {ODM} odm ODM module

*
* @return {Model}
* @return {Function}
*/

@@ -61,7 +38,7 @@ module.exports = function (odm, mongoCollection) {

/**
* @name Model
* @class Document Model Customized class for a mongodb document schema.
* @name BaseModel
* @class Document Customized class for a mongodb document schema.
* @constructor
*/
var Model = function () {
var BaseModel = function () {
};

@@ -72,3 +49,3 @@

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object} query Query object as in mongodb documentation

@@ -79,3 +56,3 @@ * @param {Object|Function} [fields] filter fields

*/
Model.findOne = function (query, fields, options, callback) {
BaseModel.findOne = function (query, fields, options, callback) {
var hasFields = true;

@@ -122,3 +99,3 @@

// enhance the DB document do have ODM features
documentLoaded.__proto__ = Model.prototype;
documentLoaded[PROTO] = BaseModel.prototype;
callback(null, documentLoaded);

@@ -131,3 +108,3 @@ });

*
* @memberOf Model
* @memberOf BaseModel
* @param {ObjectID|String} id Either a ObjectId instance or, the function will try to cast it to ObjectId.

@@ -138,3 +115,3 @@ * @param {Object|Function} [fields] filter fields

*/
Model.findById = function (id, fields, options, callback) {
BaseModel.findById = function (id, fields, options, callback) {
var hasFields = true;

@@ -198,3 +175,3 @@

// enhance the DB document do have ODM features
documentLoaded.__proto__ = Model.prototype;
documentLoaded[PROTO] = BaseModel.prototype;
callback(null, documentLoaded);

@@ -207,3 +184,3 @@ });

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object} query MongoDB Query

@@ -214,3 +191,3 @@ * @param {Object|Function} [fields] filter the fields to be returned

*/
Model.find = function (query, fields, options, callback) {
BaseModel.find = function (query, fields, options, callback) {
var hasFields = true;

@@ -261,3 +238,3 @@

// enhance the DB document do have ODM features
documentsLoaded[i].__proto__ = Model.prototype;
documentsLoaded[i][PROTO] = BaseModel.prototype;
}

@@ -272,3 +249,3 @@ return callback(null, documentsLoaded);

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object|Function} [fields] filter the fields to be returned

@@ -278,4 +255,4 @@ * @param {Object|Function} [options] options for the query

*/
Model.findAll = function (fields, options, callback) {
Model.find({}, fields, options, callback);
BaseModel.findAll = function (fields, options, callback) {
BaseModel.find({}, fields, options, callback);
};

@@ -287,3 +264,3 @@

*
* @memberOf Model
* @memberOf BaseModel
* @param {ObjectID|ObjectID[]} ids single or array of ObjectId objects

@@ -294,3 +271,3 @@ * @param {Object|Function} [fields] filter the fields to be returned

*/
Model.loadDbRef = function (ids, fields, options, callback) {
BaseModel.loadDbRef = function (ids, fields, options, callback) {
var hasFields = true;

@@ -318,3 +295,3 @@

if (!Array.isArray(ids)) {
return Model.findById(ids, options, callback);
return BaseModel.findById(ids, options, callback);
}

@@ -376,3 +353,3 @@

result[indexes[j]] = documentsLoaded[i];
result[indexes[j]].__proto__ = Model.prototype;
result[indexes[j]][PROTO] = BaseModel.prototype;
}

@@ -394,3 +371,3 @@ }

*/
Model.ensureIndex = function (fieldOrSpec, options, callback) {
BaseModel.ensureIndex = function (fieldOrSpec, options, callback) {
if (callback === undefined) {

@@ -410,3 +387,3 @@ callback = options;

Model[methodName] = function (id, fields, options, callback) {
BaseModel[methodName] = function (id, fields, options, callback) {
var hasFields = true;

@@ -474,3 +451,3 @@

documentLoaded.__proto__ = Model.prototype;
documentLoaded[PROTO] = BaseModel.prototype;
callback(null, documentLoaded);

@@ -494,7 +471,7 @@ });

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.prototype.save = function (options, callback) {
BaseModel.prototype.save = function (options, callback) {
if (callback === undefined) {

@@ -524,7 +501,7 @@ callback = options;

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.prototype.update = function (partUpdate, options, callback) {
BaseModel.prototype.update = function (partUpdate, options, callback) {
if (callback === undefined) {

@@ -589,7 +566,7 @@ if (options === undefined) {

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.prototype.insert = function (options, callback) {
BaseModel.prototype.insert = function (options, callback) {
if (callback === undefined) {

@@ -606,7 +583,7 @@ callback = options;

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error) with the result of the operation
*/
Model.prototype.remove = function (options, callback) {
BaseModel.prototype.remove = function (options, callback) {
if (callback === undefined) {

@@ -620,3 +597,3 @@ callback = options;

Model.prototype.reload = function (options, callback) {
BaseModel.prototype.reload = function (options, callback) {
if (callback === undefined) {

@@ -634,3 +611,3 @@ callback = options;

Model.findById(_id, options, function (err, documentLoaded) {
BaseModel.findById(_id, options, function (err, documentLoaded) {
if (err) {

@@ -661,3 +638,3 @@ return callback(err);

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object} query Search query of objects to remove

@@ -667,3 +644,3 @@ * @param {Object|Function} [options] options for the query

*/
Model.remove = function (query, options, callback) {
BaseModel.remove = function (query, options, callback) {
if (callback === undefined) {

@@ -680,7 +657,7 @@ callback = options;

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.save = function (document, options, callback) {
BaseModel.save = function (document, options, callback) {
if (callback === undefined) {

@@ -697,7 +674,7 @@ callback = options;

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.insert = function (document, options, callback) {
BaseModel.insert = function (document, options, callback) {
if (callback === undefined) {

@@ -714,3 +691,3 @@ callback = options;

*
* @memberOf Model
* @memberOf BaseModel
* @param {Object} query Search query of objects to remove

@@ -720,3 +697,3 @@ * @param {Object|Function} [options] options for the query

*/
Model.update = function (query, document, options, callback) {
BaseModel.update = function (query, document, options, callback) {
if (callback === undefined) {

@@ -730,3 +707,3 @@ callback = options;

return Model;
return BaseModel;
};

@@ -16,31 +16,8 @@ 'use strict';

var baseModel = require('./freemodel');
var common = require('./common');
/**
* Extracts one option from the object and returns it.
* @private
*/
function extractOption(name, options, defaultValue) {
var option = defaultValue;
if (options) {
if (options.hasOwnProperty(name)) {
option = options[name];
delete options[name];
}
}
return option;
}
var extractOption = common.extractOption;
var getOption = common.getOption;
/**
* Gets one option from the object and returns it.
* @private
*/
function getOption(name, options, defaultValue) {
var option = defaultValue;
if (options) {
if (options.hasOwnProperty(name)) {
option = options[name];
}
}
return option;
}
var PROTO = '__proto__';

@@ -55,3 +32,3 @@ /**

*
* @return {Model}
* @return {Function}
*/

@@ -61,8 +38,7 @@ module.exports = function (odm, mongoCollection, schemaDef) {

/**
* @name Model
* @class Document Model Customized class for a mongodb document schema.
* @class SchemaModel
* @param {Object} [json] if provided will update the current instance with the json properties
*/
var Model = function (json) {
if (this instanceof Model) {
var SchemaModel = function (json) {
if (this !== undefined && this instanceof SchemaModel) {
// new instance

@@ -80,3 +56,3 @@ if (json !== undefined && json !== null) {

if (json !== undefined && json !== null) {
json.__proto__ = Model.prototype;
json[PROTO] = SchemaModel.prototype;
}

@@ -90,5 +66,5 @@ return json;

*
* @memberOf Model
* @memberOf SchemaModel
*/
Object.defineProperty(Model, '$schema', {value: odm.createSchema(schemaDef)});
Object.defineProperty(SchemaModel, '$schema', {value: odm.createSchema(schemaDef)});

@@ -98,3 +74,3 @@ /**

*/
Object.defineProperty(Model, '$embeds', {value: []});
Object.defineProperty(SchemaModel, '$embeds', {value: {}});

@@ -107,4 +83,4 @@ /**

*/
Model.prototype.validate = function (verbose) {
var validation = odm.validate(this, Model.$schema);
SchemaModel.prototype.validate = function (verbose) {
var validation = odm.validate(this, SchemaModel.$schema);
if (Array.isArray(validation)) {

@@ -133,3 +109,3 @@ if (validation.length > 0) {

*/
Model.prototype.isValid = function () {
SchemaModel.prototype.isValid = function () {
return this.validate();

@@ -140,7 +116,8 @@ };

* Clones the Type prototype to this model class
* @deprecated
* @param path {String} Path to be updated
* @param type {Object} Type prototype to be copied
*/
Model.embeds = function (path, type) {
Model.$embeds.push({path: path, type: type});
SchemaModel.embeds = function (path, type) {
SchemaModel.$embeds[path] = type;
};

@@ -153,3 +130,3 @@

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object} query Query object as in mongodb documentation

@@ -160,3 +137,3 @@ * @param {Object|Function} [fields] filter fields

*/
Model.findOne = function (query, fields, options, callback) {
SchemaModel.findOne = function (query, fields, options, callback) {
var hasFields = true;

@@ -178,3 +155,2 @@

var wantExtend = extractOption('extend', options, true);
var pluck = extractOption('pluck', options);

@@ -202,7 +178,3 @@

} else {
if (wantExtend) {
documentLoaded.__proto__ = Model.prototype;
} else {
documentLoaded.__proto__ = BaseModel.prototype;
}
documentLoaded[PROTO] = SchemaModel.prototype;
}

@@ -217,3 +189,3 @@

*
* @memberOf Model
* @memberOf SchemaModel
* @param {ObjectID|String} id Either a ObjectId instance or, the function will try to cast it to ObjectId.

@@ -224,3 +196,3 @@ * @param {Object|Function} [fields] filter fields

*/
Model.findById = function (id, fields, options, callback) {
SchemaModel.findById = function (id, fields, options, callback) {
var hasFields = true;

@@ -242,3 +214,2 @@

var wantExtend = extractOption('extend', options, true);
var pluck = extractOption('pluck', options);

@@ -283,7 +254,3 @@

} else {
if (wantExtend) {
documentLoaded.__proto__ = Model.prototype;
} else {
documentLoaded.__proto__ = BaseModel.prototype;
}
documentLoaded[PROTO] = SchemaModel.prototype;
}

@@ -297,3 +264,3 @@ callback(null, documentLoaded);

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object} query MongoDB Query

@@ -304,3 +271,3 @@ * @param {Object|Function} [fields] filter the fields to be returned

*/
Model.find = function (query, fields, options, callback) {
SchemaModel.find = function (query, fields, options, callback) {
var hasFields = true;

@@ -322,3 +289,2 @@

var wantExtend = extractOption('extend', options, true);
var pluck = extractOption('pluck', options);

@@ -339,2 +305,43 @@ var wantCursor = getOption('cursor', options);

if (wantCursor) {
var origEach = documentsLoaded.each;
var origNextObject = documentsLoaded.nextObject;
documentsLoaded.each = function (callback) {
origEach(function (error, item) {
if (error) {
callback(error);
} else {
if (item !== null) {
if (hasFields) {
if (pluck !== undefined) {
callback(error, item[pluck]);
}
} else {
item[PROTO] = SchemaModel.prototype;
callback(error, item);
}
}
}
});
};
documentsLoaded.nextObject = function (callback) {
origNextObject(function (error, item) {
if (error) {
callback(error);
} else {
if (item !== null) {
if (hasFields) {
if (pluck !== undefined) {
callback(error, item[pluck]);
}
} else {
item[PROTO] = SchemaModel.prototype;
callback(error, item);
}
}
}
});
};
return callback(null, documentsLoaded);

@@ -351,10 +358,4 @@ }

} else {
if (wantExtend) {
for (i = 0, len = documentsLoaded.length; i < len; i++) {
documentsLoaded[i].__proto__ = Model.prototype;
}
} else {
for (i = 0, len = documentsLoaded.length; i < len; i++) {
documentsLoaded[i].__proto__ = BaseModel.prototype;
}
for (i = 0, len = documentsLoaded.length; i < len; i++) {
documentsLoaded[i][PROTO] = SchemaModel.prototype;
}

@@ -369,3 +370,3 @@ }

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object|Function} [fields] filter the fields to be returned

@@ -375,4 +376,4 @@ * @param {Object|Function} [options] options for the query

*/
Model.findAll = function (fields, options, callback) {
Model.find({}, fields, options, callback);
SchemaModel.findAll = function (fields, options, callback) {
SchemaModel.find({}, fields, options, callback);
};

@@ -384,3 +385,3 @@

*
* @memberOf Model
* @memberOf SchemaModel
* @param {ObjectID|ObjectID[]} ids single or array of ObjectId objects

@@ -391,3 +392,3 @@ * @param {Object|Function} [fields] filter the fields to be returned

*/
Model.loadDbRef = function (ids, fields, options, callback) {
SchemaModel.loadDbRef = function (ids, fields, options, callback) {
var hasFields = true;

@@ -415,6 +416,5 @@

if (!Array.isArray(ids)) {
return Model.findById(ids, fields, options, callback);
return SchemaModel.findById(ids, fields, options, callback);
}
var wantExtend = extractOption('extend', options, true);
var pluck = extractOption('pluck', options);

@@ -476,7 +476,3 @@

if (wantExtend) {
result[indexes[j]].__proto__ = Model.prototype;
} else {
result[indexes[j]].__proto__ = BaseModel.prototype;
}
result[indexes[j]][PROTO] = SchemaModel.prototype;
}

@@ -498,3 +494,3 @@ }

*/
Model.ensureIndex = function (fieldOrSpec, options, callback) {
SchemaModel.ensureIndex = function (fieldOrSpec, options, callback) {
if (callback === undefined) {

@@ -514,3 +510,3 @@ callback = options;

Model[methodName] = function (id, fields, options, callback) {
SchemaModel[methodName] = function (id, fields, options, callback) {
var hasFields = true;

@@ -532,3 +528,2 @@

var wantExtend = extractOption('extend', options, true);
var pluck = extractOption('pluck', options);

@@ -574,7 +569,3 @@

} else {
if (wantExtend) {
documentLoaded.__proto__ = Model.prototype;
} else {
documentLoaded.__proto__ = BaseModel.prototype;
}
documentLoaded[PROTO] = SchemaModel.prototype;
}

@@ -599,7 +590,7 @@ callback(null, documentLoaded);

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.prototype.save = function (options, callback) {
SchemaModel.prototype.save = function (options, callback) {
if (callback === undefined) {

@@ -634,7 +625,7 @@ callback = options;

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.prototype.update = function (partUpdate, options, callback) {
SchemaModel.prototype.update = function (partUpdate, options, callback) {
if (callback === undefined) {

@@ -710,7 +701,7 @@ if (options === undefined) {

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.prototype.insert = function (options, callback) {
SchemaModel.prototype.insert = function (options, callback) {
if (callback === undefined) {

@@ -732,9 +723,9 @@ callback = options;

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error) with the result of the operation
*/
Model.prototype.remove = BaseModel.prototype.remove;
SchemaModel.prototype.remove = BaseModel.prototype.remove;
Model.prototype.reload = BaseModel.prototype.reload;
SchemaModel.prototype.reload = BaseModel.prototype.reload;

@@ -744,3 +735,3 @@ /**

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object} query Search query of objects to remove

@@ -750,3 +741,3 @@ * @param {Object|Function} [options] options for the query

*/
Model.remove = BaseModel.remove;
SchemaModel.remove = BaseModel.remove;

@@ -756,7 +747,7 @@ /**

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object|Function} [options] options for the query
* @param {Function} callback Callback function (error, documentId) with the result of the operation
*/
Model.insert = BaseModel.insert;
SchemaModel.insert = BaseModel.insert;

@@ -766,3 +757,3 @@ /**

*
* @memberOf Model
* @memberOf SchemaModel
* @param {Object} query Search query of objects to remove

@@ -772,5 +763,5 @@ * @param {Object|Function} [options] options for the query

*/
Model.update = BaseModel.update;
SchemaModel.update = BaseModel.update;
return Model;
return SchemaModel;
};

@@ -8,3 +8,3 @@ {

],
"version": "3.0.7",
"version": "3.0.8",
"engines": {

@@ -11,0 +11,0 @@ "node": ">=0.4.12"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc