Comparing version 2.11.3 to 2.11.4
@@ -258,4 +258,6 @@ var _ = require('lodash'), | ||
var cacheDoc = _.cloneDeep(target); | ||
var wrapped = target; | ||
var wrapped = options.wrap ? wrapper(target, false, options.partial) : this.fromSource(target); | ||
if(options.wrap) wrapped = wrapper(target, false, options.partial); | ||
else this.fromSource(wrapped); | ||
@@ -262,0 +264,0 @@ doHook(this.options.hooks.ready, wrapped, (function(err) { |
{ | ||
"name": "iridium", | ||
"version": "2.11.3", | ||
"version": "2.11.4", | ||
"author": "Benjamin Pannell <admin@sierrasoftworks.com>", | ||
@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users", |
@@ -111,2 +111,33 @@ var config = require('./config.js'); | ||
describe('with wrap:false', function() { | ||
before(function(done) { | ||
model = new Model(db, 'model', { | ||
name: /.+/ | ||
}, { | ||
}); | ||
model.remove(function(err) { | ||
if(err) return done(err); | ||
model.create({ | ||
name: 'Demo1' | ||
}, function(err, instance) { | ||
if(err) return done(err); | ||
return done(); | ||
}); | ||
}); | ||
}); | ||
it('should return the raw document', function(done) { | ||
model.findOne({ name: 'Demo1' }, { wrap: false }, function(err, doc) { | ||
should.not.exist(err); | ||
should.exist(doc); | ||
doc.should.have.ownProperty('id'); | ||
doc.should.have.ownProperty('name').and.eql('Demo1'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('with partial results', function() { | ||
@@ -152,2 +183,12 @@ before(function(done) { | ||
}); | ||
it('should work with wrap: false', function(done) { | ||
model.findOne({ name: 'Demo1' }, { wrap: false, fields: { id: 1, name: 1 }}, function(err, doc) { | ||
if(err) return done(err); | ||
should.exist(doc); | ||
doc.should.have.ownProperty('name').and.eql('Demo1'); | ||
doc.should.not.have.ownProperty('description'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -154,0 +195,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146920
2700