Socket
Socket
Sign inDemoInstall

mongoose

Package Overview
Dependencies
Maintainers
4
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 2.3.2 to 2.3.3

6

History.md
2.3.3 / 2011-10-12
==================
* fixed; population conditions in multi-query settings [vedmalex] (#563)
* fixed; now compatible with Node v0.5.x
2.3.2 / 2011-10-11

@@ -3,0 +9,0 @@ ==================

2

lib/index.js

@@ -276,3 +276,3 @@

exports.version = '2.3.2';
exports.version = '2.3.3';

@@ -279,0 +279,0 @@ /**

@@ -197,4 +197,4 @@

, schema = self.schema.path(path)
, poppath = populate[path]
, total = 0
, poppath

@@ -206,4 +206,9 @@ if (!schema && obj[i] && 'Object' === obj[i].constructor.name) {

if (!(obj[i] && schema && poppath)) return next();
if (!(obj[i] && schema && populate[path])) return next();
// this query object is re-used and passed around. we clone
// it to prevent query condition contamination between
// one populate call to the next.
poppath = utils.clone(populate[path]);
if (poppath.sub) {

@@ -210,0 +215,0 @@ obj[i].forEach(function (subobj) {

@@ -135,5 +135,5 @@

'writeUInt8 writeUInt16 writeUInt32 writeInt8 writeInt16 writeInt32 ' +
'writeFloat writeDouble fill' +
'utf8Write binaryWrite asciiWrite set'.split(' ').forEach(function (method) {
;('writeUInt8 writeUInt16 writeUInt32 writeInt8 writeInt16 writeInt32 ' +
'writeFloat writeDouble fill ' +
'utf8Write binaryWrite asciiWrite set').split(' ').forEach(function (method) {
if (!Buffer.prototype[method]) return;

@@ -140,0 +140,0 @@ MongooseBuffer.prototype[method] = new Function(

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

@@ -14,3 +14,3 @@ , "keywords": ["mongodb", "mongoose", "orm", "data", "datastore", "nosql"]

"should": "0.2.1"
, "gleak": "0.1.3"
, "gleak": "0.2.0"
}

@@ -17,0 +17,0 @@ , "directories": { "lib": "./lib/mongoose" }

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

, should = require('should')
, Table = require('cli-table')
, Table = require('../support/cli-table')
, Mongoose = mongoose.Mongoose

@@ -11,0 +11,0 @@ , Collection = mongoose.Collection

@@ -1036,2 +1036,75 @@

'populating more than one array at a time': function () {
var db = start()
, User = db.model('RefUser', users)
, M = db.model('PopMultiSubDocs', new Schema({
users: [{ type: ObjectId, ref: 'RefUser' }]
, fans: [{ type: ObjectId, ref: 'RefUser' }]
, comments: [Comment]
}))
User.create({
email : 'fan1@learnboost.com'
}, {
name : 'Fan 2'
, email : 'fan2@learnboost.com'
, gender : 'female'
}, {
name: 'Fan 3'
}, function (err, fan1, fan2, fan3) {
should.strictEqual(err, null);
M.create({
users: [fan3]
, fans: [fan1]
, comments: [
{ _creator: fan1, content: 'bejeah!' }
, { _creator: fan2, content: 'chickfila' }
]
}, {
users: [fan1]
, fans: [fan2]
, comments: [
{ _creator: fan3, content: 'hello' }
, { _creator: fan1, content: 'world' }
]
}, function (err, post1, post2) {
should.strictEqual(err, null);
M.where('_id').in([post1, post2])
.populate('fans', 'name', { gender: 'female' })
.populate('users', 'name', { gender: 'male' })
.populate('comments._creator', ['email'], { name: null })
.run(function (err, posts) {
db.close();
should.strictEqual(err, null);
should.exist(posts);
posts.length.should.equal(2);
var p1 = posts[0];
var p2 = posts[1];
should.strictEqual(p1.fans.length, 0);
should.strictEqual(p2.fans.length, 1);
p2.fans[0].name.should.equal('Fan 2');
p2.fans[0].isInit('email').should.be.false;
p2.fans[0].isInit('gender').should.be.false;
p1.comments.length.should.equal(2);
p2.comments.length.should.equal(2);
should.exist(p1.comments[0]._creator.email);
should.not.exist(p2.comments[0]._creator);
p1.comments[0]._creator.email.should.equal('fan1@learnboost.com');
p2.comments[1]._creator.email.should.equal('fan1@learnboost.com');
p1.comments[0]._creator.isInit('name').should.be.false;
p2.comments[1]._creator.isInit('name').should.be.false;
p1.comments[0].content.should.equal('bejeah!');
p2.comments[1].content.should.equal('world');
should.not.exist(p1.comments[1]._creator);
should.not.exist(p2.comments[0]._creator);
p1.comments[1].content.should.equal('chickfila');
p2.comments[0].content.should.equal('hello');
});
});
});
},
'refs should cast to ObjectId from hexstrings': function () {

@@ -1038,0 +1111,0 @@ var BP = mongoose.model('RefBlogPost', BlogPost);

Sorry, the diff of this file is not supported yet

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