My database contains the following data:
I have stationId
and have to find deptDate
of that object which is inside the midStations
array
How can i write the query in mongoose or mongodb? Any suggestions are welcomed! Thank you!
_id:606915e7a5ac8c24b40c7879 midStations:Array 0:Object _id:606915e7a5ac8c24b40c76c9 station:Object stationId:6067edac5520535104a16c88 arrDate:2021-04-04T08:30:00.000+00:00 deptDate:2021-04-03T08:35:00.000+00:00 1:Object _id:606915e7a5ac8c24b40c76ca station:Object stationId:6067eda35520535104a16c87 arrDate:2021-04-04T10:30:00.000+00:00 deptDate:2021-04-04T10:35:00.000+00:00 2:Object _id:606915e7a5ac8c24b40c76cb station:Object stationId:6067edd25520535104a16c8b arrDate:2021-04-04T12:30:00.000+00:00 deptDate:2021-04-04T12:35:00.000+00:00
https://stackoverflow.com/questions/66944726/mongoose-query-to-find-any-field-inside-array-of-objects April 05, 2021 at 02:47AM
没有评论:
发表评论