Database
[{"_id":ObjectId("5fc17630cf8dff0cd5506dc4"),"asks":[{price:23685.0,quantity:0.008},{price:23688.8,quantity:0.000},{price:23696.7,quantity:0.000}],"bids":[{price:23553.7,quantity:0.200},{price:23557.8,quantity:0.207},{price:23558.4,quantity:0.045},{price:23563.4,quantity:0.020}],"timestamp":1606514176211,"datetime":"2020-11-15","ticker":"YFI/USDT"},{"_id":ObjectId("5fc17630cf8dff0cd5506dc5"),"asks":[{price:23685.0,quantity:0.008},{price:23688.8,quantity:0.000},{price:23696.7,quantity:0.000}],"bids":[{price:23553.7,quantity:0.200},{price:23557.8,quantity:0.207},{price:23558.4,quantity:0.045},{price:23563.4,quantity:0.020}],"timestamp":1606514176211,"datetime":"2020-10-27","ticker":"YFI/USDT"},{"_id":ObjectId("5fc17630cf8dff0cd5506dc7"),"asks":[{price:23685.0,quantity:0.008},{price:23688.8,quantity:0.000},{price:23696.7,quantity:0.000}],"bids":[{price:23553.7,quantity:0.200},{price:23557.8,quantity:0.207},{price:23558.4,quantity:0.045},{price:23563.4,quantity:0.020}],"timestamp":1606514176211,"datetime":"2020-11-27","ticker":"YFI/USDT"},]
Query
db.collection.aggregate([{"$match":{$expr:{"$and":[{"$gte":["$datetime","2020-11-01"]},{"$lt":["$datetime","2020-12-01"]}]}}},{"$addFields":{"asks":{"$filter":{"input":"$asks","as":"ask","cond":{"$gte":["$$ask.price",23686]}}}}}])