Skip to content

Commit

Permalink
fix:lint
Browse files Browse the repository at this point in the history
  • Loading branch information
IslandRhythms committed Jul 18, 2023
1 parent 66c4a8e commit 1e3c96f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -2880,14 +2880,14 @@ Model.create = async function create(doc, options) {
} else {
let firstError = null;
res = await Promise.all(args.map(async doc => {
const Model = this.discriminators && doc[discriminatorKey] != null ?
const Model = this.discriminators && doc[discriminatorKey] != null ?
this.discriminators[doc[discriminatorKey]] || getDiscriminatorByValue(this.discriminators, doc[discriminatorKey]) :
this;
if (Model == null) {
throw new MongooseError(`Discriminator "${doc[discriminatorKey]}" not ` +
if (Model == null) {
throw new MongooseError(`Discriminator "${doc[discriminatorKey]}" not ` +
`found for model "${this.modelName}"`);
}
try {
}
try {
let toSave = doc;

if (!(toSave instanceof Model)) {
Expand Down
4 changes: 2 additions & 2 deletions test/model.create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ describe('model', function() {
for (let i = 0; i < 11; i++) {
data.push({ name: 'Test' + Math.abs(i - 4) });
}
const res = await Test.create(data, { ordered: false }).catch(err => err);
await Test.create(data, { ordered: false }).catch(err => err);
const docs = await Test.find();
assert.equal(docs.length, 7); // docs 1,2,3,4 should not go through 11-4 == 7
})
});
});
});
});

0 comments on commit 1e3c96f

Please sign in to comment.