Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Automattic/mongoose
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed May 16, 2019
2 parents b642e17 + 7f4c2f0 commit a22bf13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/schema/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ SchemaString.prototype.$conditionalHandlers =
$gte: handleSingle,
$lt: handleSingle,
$lte: handleSingle,
$options: handleSingle,
$options: String,
$regex: handleSingle,
$not: handleSingle
});
Expand Down
11 changes: 11 additions & 0 deletions test/model.query.casting.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,17 @@ describe('model query casting', function() {
assert.equal(result.tags.$options, 'img');
done();
});
it('does not cast with uppercase (gh-7800)', function(done) {
const testSchema = new Schema({
name: { type: String, uppercase: true }
});

const Model = db.model('gh7800', testSchema);
const result = Model.find({}).cast(Model, {name: {$regex: /a/, $options: 'i'}});

assert.equal(result.name.$options, 'i');
done();
});
});

describe('$elemMatch', function() {
Expand Down

0 comments on commit a22bf13

Please sign in to comment.