Skip to content

Commit

Permalink
test(schema): repro #7480
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Feb 8, 2019
1 parent bee1e1b commit ebff7ba
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1942,4 +1942,20 @@ describe('schema', function() {

return Promise.resolve();
});

it('supports _id: false in paths definition (gh-7480)', function() {
const schema = new Schema({ _id: false, name: String });
assert.ok(schema.path('_id') == null);
assert.equal(schema.options._id, false);

return Promise.resolve();
});

it('throws if any property other than `_id` is `false` (gh-7480)', function() {
assert.throws(() => {
new Schema({ name: false });
}, /invalid.*name/i);

return Promise.resolve();
});
});

0 comments on commit ebff7ba

Please sign in to comment.