diff --git a/lib/dao.js b/lib/dao.js index b95db578..1200b82b 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -2722,13 +2722,6 @@ DataAccessObject.replaceById = function(id, data, options, cb) { } function callConnector() { - var idNames = Model.definition.idNames(); - var propKeys = Object.keys(Model.definition.properties); - var nonIdsPropKeys = propKeys.filter(function(i) { return idNames.indexOf(i) < 0; }); - for (var i = 0; i < nonIdsPropKeys.length; i++) { - var p = nonIdsPropKeys[i]; - inst[p] = null; - } copyData(data, inst); var typedData = convertSubsetOfPropertiesByType(inst, data); context.data = typedData; diff --git a/test/manipulation.test.js b/test/manipulation.test.js index 3317a3b8..579ee02c 100644 --- a/test/manipulation.test.js +++ b/test/manipulation.test.js @@ -800,8 +800,8 @@ describe('manipulation', function() { p.id.should.equal(created.id); p.should.not.have.property('_id'); p.title.should.equal('b'); - p.should.not.have.property(p.content); - p.should.not.have.property(p.comments); + p.should.have.property('content', undefined); + p.should.have.property('comments', undefined); return Post.findById(created.id) .then(function(p) { p.should.not.have.property('_id'); @@ -830,8 +830,8 @@ describe('manipulation', function() { p.id.should.equal(created.id); p.should.not.have.property('_id'); p.title.should.equal('b'); - p.should.not.have.property(p.content); - p.should.not.have.property(p.comments); + p.should.have.property('content', undefined); + p.should.have.property('comments', undefined); return Post.findById(created.id) .then(function(p) { p.should.not.have.property('_id'); @@ -858,8 +858,8 @@ describe('manipulation', function() { p.id.should.equal(post.id); p.should.not.have.property('_id'); p.title.should.equal('b'); - p.should.not.have.property(p.content); - p.should.not.have.property(p.comments); + p.should.have.property('content', undefined); + p.should.have.property('comments', undefined); Post.findById(post.id, function(err, p) { if (err) return done(err); p.id.should.eql(post.id); @@ -887,8 +887,8 @@ describe('manipulation', function() { p.id.should.equal(post.id); p.should.not.have.property('_id'); p.title.should.equal('b'); - p.should.not.have.property(p.content); - p.should.not.have.property(p.comments); + p.should.have.property('content', undefined); + p.should.have.property('comments', undefined); Post.findById(post.id, function(err, p) { if (err) return done(err); p.id.should.eql(post.id); @@ -992,7 +992,7 @@ describe('manipulation', function() { should.exist(p); p.should.be.instanceOf(Post); p.title.should.equal('b'); - p.should.not.have.property('content', undefined); + p.should.have.property('content', undefined); return Post.findById(postInstance.id) .then(function(p) { p.title.should.equal('b'); @@ -1012,7 +1012,7 @@ describe('manipulation', function() { should.exist(p); p.should.be.instanceOf(Post); p.title.should.equal('b'); - p.should.not.have.property('content', undefined); + p.should.have.property('content', undefined); return Post.findById(postInstance.id) .then(function(p) { p.title.should.equal('b'); @@ -1029,7 +1029,7 @@ describe('manipulation', function() { if (err) return done(err); p.replaceAttributes({ title: 'b' }, function(err, p) { if (err) return done(err); - p.should.not.have.property('content', undefined); + p.should.have.property('content', undefined); p.title.should.equal('b'); done(); }); @@ -1041,7 +1041,7 @@ describe('manipulation', function() { if (err) return done(err); p.replaceAttributes({ title: 'b' }, { validate: false }, function(err, p) { if (err) return done(err); - p.should.not.have.property('content', undefined); + p.should.have.property('content', undefined); p.title.should.equal('b'); done(); });