We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a015f9 commit 3e60145Copy full SHA for 3e60145
lib/schema.js
@@ -25,6 +25,8 @@ const utils = require('./utils');
25
const validateRef = require('./helpers/populate/validateRef');
26
const util = require('util');
27
28
+const hasNumericSubpathRegex = /\.\d+(\.|$)/;
29
+
30
let MongooseTypes;
31
32
const queryHooks = require('./helpers/query/applyQueryMiddleware').
@@ -1008,7 +1010,7 @@ Schema.prototype.path = function(path, obj) {
1008
1010
}
1009
1011
1012
// subpaths?
- return /\.\d+\.?.*$/.test(path)
1013
+ return hasNumericSubpathRegex.test(path)
1014
? getPositionalPath(this, path, cleanPath)
1015
: undefined;
1016
0 commit comments