Mongodb Time-to-Place Query Criteria

  mongodb, question

The data structure is

{
 "_id" : ObjectId("59e05fa63e0f5015dcaeadbe"),
 "name" : "santu",
 "mes": "Test Message 1",
 "time" : ISODate("2017-10-13T06:39:34.273Z"),
 "replay" : [
 {
 "time" : ISODate("2017-10-13T06:39:55.365Z"),
 "_id" : ObjectId("59e05fbb3e0f5015dcaeadbf"),
 "replayer" : "santu",
 "replaymes": "Test Message Reply 1"
 },
 {
 "time" : ISODate("2017-10-16T06:03:36.188Z"),
 "_id" : ObjectId("59e44bb81f111527f8dc8bd1"),
 "replayer" : "santubaby",
 "replaymes": "Test Message Reply 33333"
 }
 ],
 "__v" : 0
 }
db.mesModel.aggregate(
 {"$project":{"replay":"$replay"}},
 {"$unwind":"$replay"},
 {"$ match": {"$match":{"replay.replaymes ":'test message reply 33333',' reply.time':' isodate ("2017-10-16t06: 03: 36.188z ")'}}, (e, d) = > {.
 console.log(d)
 }
 )

In this way, the empty set is printed, but if you change replay.time to replay.replayer:’xxx’, you will be able to find a normal match for the thigh child.

'replay.time':'ISODate("2017-10-16T06:03:36.188Z")'

===>

'replay.time':ISODate("2017-10-16T06:03:36.188Z")

try