I am trying to query the data from a collection with a date range field , my document has regex search implemented,
my query is as follows,
db.getCollection('_event').find([{"name":{"$regex":"2017","$options":"i"}},{},{"date.start:{$gte":"2017-03-07T18:30:00.000Z"},{"date.end:{$lt":"2017-11-16T18:30:00.000Z"}])
and mongo throws an error
Error: error: { "waitedMS" : NumberLong(0), "ok" : 0, "errmsg" : "Failed to parse: filter: [ { name: { $regex: \"2017\", $options: \"i\" } }, {}, { date.start:{$gte: \"2017-03-07T18:30:00.000Z\" }, { date.end:{$lt: \"2017-11-16T18:30:00.000Z\" } ]. 'filter' field must be of BSON type Object.", "code" : 9 }
any help guys?
via Sajeetharan
No comments:
Post a Comment