我有一个存储在 mongodb 中的 JSON 文档,其中一个子文档是日期时间戳。我需要查询和过滤日期范围之间的子文档。
我正在使用 mongo shell 来处理查询。
{
"_id": ObjectID("5d9bf09c242af456ff5dd149"),
"configId": "c2",
"name": "ajit test",
"description": "this is test desc",
"confidence": 0,
"report": {
"2019-10-05T02:12:44Z": [
{
"VariantId": "1",
"bestProbability": "3.2",
"hdi": {
"low": "2.1",
"high": "4.0"
}
},
{
"VariantId": "2",
"bestProbability": "3.2",
"hdi": {
"low": "4.5",
"high": "4.7"
}
}
],
"2019-10-06T02:12:44Z": [
{
"VariantId": "1",
"bestProbability": "3.2",
"hdi": {
"low": "2.1",
"high": "4.0"
}
},
{
"VariantId": "2",
"bestProbability": "3.2",
"hdi": {
"low": "4.5",
"high": "4.7"
}
}
],
"2019-10-08T02:12:44Z": [
{
"VariantId": "1",
"bestProbability": "3.2",
"hdi": {
"low": "3.5",
"high": "6.7"
}
},
{
"VariantId": "2",
"bestProbability": "3.2",
"hdi": {
"low": "3.5",
"high": "6.7"
}
}
]
},
}
我正在寻找一个查询,该查询必须仅返回日期 2019-10-06T02:12:44Z 和 2019-10-08T02:12:44Z 之间的嵌入文档子集。