【发布时间】:2020-03-17 00:53:02
【问题描述】:
我查询的文档长度匹配为:
文件格式示例:
{
"_id": {
"$oid": "5e158e2de6facf7181cc368f"
},
"word": "as luck would have it",
}
查询为:
{$where: "this.word.length == 20 "}
这与以下匹配:
{
"_id": {
"$oid": "5e158e30e6facf7181cc3bdb"
},
"word": "adrenocorticotrophic",
}
{
"_id": {
"$oid": "5e158e2ee6facf7181cc38cf"
},
"word": "attributive genitive",
}
但我只想匹配 adrenocorticotrophic 而不是带有空格的单词,例如 attributive genitive
我可以知道我怎样才能像上面那样匹配吗?
感谢任何帮助!
【问题讨论】:
-
你的 MongoDB 版本是多少?
-
4.2 mate.....
标签: mongodb mongodb-query aggregation-framework pymongo