I am using regex to fetch data from mongodb from my node js application which is not working. Here is the code snippet. the query can not match with the set of records.
var analysis_date = '/^'+moment(fromTime).format('YYYY-MM').toString()+'/';
user_analysis.find({
parent_id: usrId,
analysis_date: {
$regex : analysis_date
}
},function(err, result) {
//some Code goes here});