我目前正在使用MongoChef(4.3.0)访问Azure文档数据库(using DocumentDB protocol support for MongoDB)。
有问题的数据来自Application Insights持续导出,其中包含以下类型的数据(还有其他数据,但这是我感兴趣的关键部分......)
{
... other fields ...
"request" : [
{
"name" : "GET /images/loading_man.gif",
"count" : NumberInt(1),
"responseCode" : NumberInt(200),
"success" : NumberInt(1),
"url" : "http://<removed>.cloudapp.azure.com/<something>/images/loading_man.gif"
... other fields ...
}
]
... other fields ...
}
使用MongoChef我可以执行一些基本查询,如下所示,没有问题;
{ "request": { $exists: true } }
但是任何更复杂的东西似乎都没有返回或者根本没有运行
{ "request.0.url": { $exists: true } }
{ "request.0.url": /.*man.*/i }
如果我导出此数据并将其导入我当地的MongoDb,我确实能够毫无问题地对相关数据执行此类搜索。
有关如何在不需要导出数据的情况下对相关数据执行此类搜索的任何想法吗?
(这是一个编程问题,因为我想在python程序中执行上述操作!)
答案 0 :(得分:1)
看起来我需要做的就是使用$ elemMatch!
{ "request": { $elemMatch: {url:/.*man.*/i } }}
这是我理解推荐的方式,但也更快&#39;