Socket
Socket
Sign inDemoInstall

mongoose

Package Overview
Dependencies
Maintainers
0
Versions
888
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

lib/mongoose/schema/.array.js.swn

7

History.md
1.3.5 / 2011-05-17
===================
* fixed; $ne queries work properly with single vals
* added; #inspect() methods to improve console.log output
1.3.4 / 2011-05-17

@@ -3,0 +10,0 @@ ===================

13

lib/mongoose/document.js

@@ -12,2 +12,3 @@

, clone = utils.clone
, inspect = require('util').inspect
, ActiveRoster = utils.StateMachine.ctor('require', 'modify', 'init')

@@ -678,3 +679,2 @@ , deepEqual = utils.deepEqual;

Document.prototype.toObject = function () {

@@ -696,2 +696,13 @@ return clone(this.doc, true);

/**
* Helper for console.log
*
* @api public
*/
Document.prototype.inspect = function () {
return inspect(this.doc);
};
/**
* Returns true if the Document stores the same data as doc.

@@ -698,0 +709,0 @@ * @param {Document} doc to compare to

2

lib/mongoose/index.js

@@ -292,3 +292,3 @@

exports.version = '1.3.4';
exports.version = '1.3.5';

@@ -295,0 +295,0 @@ /**

@@ -193,5 +193,10 @@ var utils = require('./utils')

if ('$ne' === $cond && null === nested) {
continue;
} else if ('$exists' === $cond) {
if ('$ne' === $cond) {
if (null === nested) continue;
if (!(Array.isArray(nested) || nested.constructor == Object)) {
continue;
}
}
if ('$exists' === $cond) {
if ('boolean' !== typeof nested) {

@@ -201,3 +206,5 @@ throw new Error("$exists parameter must be Boolean");

continue;
} else if ('$not' === $cond) {
}
if ('$not' === $cond) {
this.cast(model, val[$cond]);

@@ -204,0 +211,0 @@ } else {

@@ -286,2 +286,16 @@

/**
* Helper for console.log
*
* @api public
*/
MongooseArray.prototype.inspect = function () {
return '[' + this.map(function (doc) {
return ' ' + doc;
}) + ' ]';
};
/**
* Return the index of `obj` or `-1.`

@@ -288,0 +302,0 @@ *

@@ -6,3 +6,4 @@

var Document = require('../document');
var Document = require('../document')
, inspect = require('util').inspect;

@@ -96,2 +97,12 @@ /**

/**
* Helper for console.log
*
* @api public
*/
EmbeddedDocument.prototype.inspect = function () {
return inspect(this.toObject());
};
/**
* Register hooks for some methods

@@ -98,0 +109,0 @@ */

@@ -91,2 +91,14 @@

/**
* Helper for console.log
*
* @api public
*/
MongooseDocumentArray.prototype.inspect = function () {
return '[' + this.map(function (doc) {
return doc.inspect();
}).join('\n') + ']';
};
/**
* Module exports.

@@ -93,0 +105,0 @@ */

@@ -72,2 +72,3 @@

MongooseNumber.prototype.inspect =
MongooseNumber.prototype.toString = function () {

@@ -77,2 +78,3 @@ return String(this.valueOf());

/**

@@ -79,0 +81,0 @@ * Module exports

{
"name": "mongoose"
, "description": "Mongoose MongoDB ORM"
, "version": "1.3.4"
, "version": "1.3.5"
, "author": "Guillermo Rauch <guillermo@learnboost.com>"

@@ -6,0 +6,0 @@ , "keywords": ["mongodb", "mongoose", "orm", "data", "datastore", "nosql"]

@@ -458,2 +458,48 @@

'test find queries with $ne with single value against array': function () {
var db = start();
var schema = new Schema({
ids: [Schema.ObjectId]
, b: Schema.ObjectId
});
var NE = db.model('NE_Test', schema, 'nes__' + random());
var id1 = new DocumentObjectId;
var id2 = new DocumentObjectId;
var id3 = new DocumentObjectId;
var id4 = new DocumentObjectId;
NE.create({ ids: [id1, id4], b: id3 }, function (err, ne1) {
should.strictEqual(err, null);
NE.create({ ids: [id2, id4], b: id3 },function (err, ne2) {
should.strictEqual(err, null);
var query = NE.find({ 'b': id3.toString(), 'ids': { $ne: id1 }});
query.run(function (err, nes1) {
should.strictEqual(err, null);
nes1.length.should.eql(1);
NE.find({ b: { $ne: [1] }}, function (err, nes2) {
should.strictEqual(err, null);
nes2.length.should.eql(2);
NE.find({ b: { $ne: 4 }}, function (err, nes3) {
should.strictEqual(err, null);
nes3.length.should.eql(2);
NE.find({ b: id3, ids: { $ne: id4 }}, function (err, nes4) {
db.close();
should.strictEqual(err, null);
nes4.length.should.eql(0);
});
});
});
});
});
});
},
'test for findById where partial initialization': function () {

@@ -1210,5 +1256,4 @@ var db = start()

});
}
};

Sorry, the diff of this file is too big to display

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