0
我在这个格式的文档:MongoDB的投影不工作的Java
{
"env" : "local",
....,
"daily" : [
{
"executionParam1" : "Apple",
"executionParam2" : "sour",
"executionParam3" : "today",
...
},
{
"executionParam1" : "Oranges",
"executionParam2" : "sour",
"executionParam3" : "tomorrow",
....
}...
]
我使用MongoDB的Java驱动程序查询。该查询是这种形式:
this.mongoDailyReportCollection = this.mongoDb.getCollection("environments");
Bson projection = fields(excludeId(),
include("env", "daily"),
Projections.elemMatch("daily",
and(eq("executionParam1", coll.getexecutionParam1()),
eq("executionParam2", coll.getexecutionParam2()),
eq("executionParam3", coll.getexecutionParam3()))));
long count = this.mongoDailyReportCollection.count(projection);
我不断收到计数为0,即使executionParam1是苹果,executionParam2是又酸又executionParam3是今天。如果我想更新与此相匹配的文档,那么过程如何?