Answer the question
In order to leave comments, you need to log in
How does mongoDB array lookup via Spring Data work?
There is such a couple of thousand objects like this:
{
"_id" : ObjectId("5ffbfca73fb224209c6d27be"),
"activeStates" : ["logicConnectionLost", ...],
...,
"_class" : "Entity"
}
Answer the question
In order to leave comments, you need to log in
The answer depends on what kind of request the Spring Data will generate for the countByActiveStatesIn(Set states);
.
According to table #16 in section 15.3 of the Spring Data MongoDB documentation , a query should be generated
db.collectionName.count({ activeStates: { $in: ["logicConnectionLost"] }})
activeStates
contains at least one element from the passed list. DEBUG
:logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG
#Если используете реактивный MongoTemplate:
logging.level.org.springframework.data.mongodb.core.ReactiveMongoTemplate=DEBUG
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question