Skip to content

Commit

Permalink
style: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 19, 2019
1 parent 757579d commit 9509b47
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions lib/helpers/discriminator/getDiscriminatorByValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
*/

module.exports = function getDiscriminatorByValue(model, value) {
let discriminator = null;
if (!model.discriminators) {
return discriminator;
}
for (const name in model.discriminators) {
const it = model.discriminators[name];
if (
it.schema &&
let discriminator = null;
if (!model.discriminators) {
return discriminator;
}
for (const name in model.discriminators) {
const it = model.discriminators[name];
if (
it.schema &&
it.schema.discriminatorMapping &&
it.schema.discriminatorMapping.value == value
) {
discriminator = it;
break;
}
}
return discriminator;
}
) {
discriminator = it;
break;
}
}
return discriminator;
};
4 changes: 2 additions & 2 deletions test/model.populate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8805,13 +8805,13 @@ describe('model: populate:', function() {
it('virtual populate with discriminator that has a custom discriminator value (gh-8324)', function() {
const mainSchema = new Schema({ title: { type: String } },
{ discriminatorKey: 'type' });

mainSchema.virtual('virtualField', {
ref: 'gh8324_Model',
localField: '_id',
foreignField: 'main',
});

const discriminatedSchema = new Schema({ description: String });
const Main = db.model('gh8324_Main', mainSchema);
const Discriminator = Main.discriminator('gh8324_Discriminator',
Expand Down

0 comments on commit 9509b47

Please sign in to comment.