Skip to content

Commit

Permalink
test(document): add repro for #4542
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Oct 16, 2016
1 parent 3293a7b commit 908ed3c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3226,6 +3226,34 @@ describe('document', function() {
});
});

it('composite _ids (gh-4542)', function(done) {
var schema = new Schema({
_id: {
key1: String,
key2: String
},
content: String
}, { retainKeyOrder: true });

var Model = db.model('gh4542', schema);

var object = new Model();
object._id = {key1: 'foo', key2: 'bar'};
object.save().
then(function(obj) {
obj.content = 'Hello';
return obj.save();
}).
then(function(obj) {
return Model.findOne({ _id: obj._id });
}).
then(function(obj) {
assert.equal(obj.content, 'Hello');
done();
}).
catch(done);
});

it('setting full path under single nested schema works (gh-4578) (gh-4528)', function(done) {
var ChildSchema = new mongoose.Schema({
age: Number
Expand Down

0 comments on commit 908ed3c

Please sign in to comment.