below is the mongo document,
db.south.find({station:"Stourton"})
{ "_id" : ObjectId("572cca5a9c850445fc6c3122"),
"line" : { "map" : "north_image.jpg", "name" : "north" },
"dep" : { "dep_timing" :
[{ "time" : "09:50" },
{ "time" : "11:50" },
{ "time" : "12:50" },
{ "time" : "13:50" },
{ "time" : "14:50"},
{ "time" : "15:50" },
{ "time" : "16:50" },
{ "time" : "17:50" },
{ "time" :"18:50" },
{ "time" : "19:50" },
{ "time" : "20:50" },
{ "time" : "21:50" },
{ "time" : "22:55" } ],
"route" : [ { "station" : "CitySquare" } ] },
"station" : "Stourton" }
I am using this query to extract the time greater than or equal to "09:50",
> db.south.find({dep:{dep_timing:{"time":"09:50"}}})
But no result is output. I am new to Mongodb so please help. Thanks
The query should be like this:
db.south.find({ "dep.dep_timing.time": "09:50"})
And will return all the documents that have {"dep":{"dep_timing":{"time":"9:50"}}}
Have a look at the documentation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.