From dd3c232300245d6367028c5b061104ab790f0fed Mon Sep 17 00:00:00 2001 From: Eric Daniels Date: Tue, 3 Apr 2018 23:34:52 -0400 Subject: [PATCH] fix(regexp): properly construct new BSONRegExp when constructor called without new --- lib/bson/regexp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bson/regexp.js b/lib/bson/regexp.js index c364075d..6429ba66 100644 --- a/lib/bson/regexp.js +++ b/lib/bson/regexp.js @@ -14,7 +14,7 @@ function alphabetize(str) { * @return {BSONRegExp} A MinKey instance */ function BSONRegExp(pattern, options) { - if (!(this instanceof BSONRegExp)) return new BSONRegExp(); + if (!(this instanceof BSONRegExp)) return new BSONRegExp(pattern, options); // Execute this._bsontype = 'BSONRegExp';