我有一个具有以下结构的MongoDB:
db.http_methods.find({"methods.head.status":"200"}, {"methods.head.$":1}).pretty();
说明此查询时
{
"_id" : ObjectId("591ec4b8e1f71c0caf406f2a"),
"methods" : {
"head" : [
{
"host" : "127.0.0.1",
"port" : "8081",
"protocol" : "http:",
"path" : "/index.html",
"method" : "HEAD",
"status" : "200"
}
]
}
}
我重复了三次以下输出:
db.http_methods.find({_id:ObjectId("591ec4b8e1f71c0caf406f2a"), "methods.head.status":"200"}, {"methods.head.$":1}).pretty()
任何想法为什么?
编辑:并使用此查询
[main] Error: invalid object id: length :
我收到错误:
+----------------------+------------+
| input | output |
+----------------------+------------+
| www.google.com | google |
| www.mail.yahoo.com | mail.yahoo |
| www.mail.yahoo.co.in | mail.yahoo |
| www.abc.au.uk | abc |
www.subdoamin.domain.co.in // output subdomain