I'm trying to return documents that whose obsNum field starts with 1.. I have written the following RegEx to filter out those documents however, it returns all the documents that start with 1
Observations.getObservationsModelObject().find({
"ageGroup": ageGroup,
"obsNum": {
$regex: '^\s*1\.'
}
}, function(err, foundData) {});
What am I doing wrong?
This RegEx '^\s*1\.' is returning the following instead of returning on 1.3, 1.1 & 1.2:
obsNum: 1.3
obsNum: 1.1
obsNum: 1.2
obsNum: 123
obsNum: 121`
$regex: /^\s*1\./