I am using maven project with spring-data-mongodb
. I created a model class my model class is
@Id
private String _id;
private String message;
private String possibleAnswer;
private boolean resolved;
private String percenteageMatch;
//Getters and Setters
Then i Created a an iterface with
public interface ContextRepository extends MongoRepository<ContextUnknown, String>{}
Now in my controller i want to find all the contextUnkown documents which are not resolved.
I know the query in mongodb is db.getCollection('ContextUnknown').find({"resolved": true})
.
I am unable to write it in to spring boot i tried adding Creria
Query query = new Query();
query.addCriteria(Criteria.where("resolved").is(false));
return contextRepository.findAll(query)
This is not working as findall doesn't take query as parameter, i tried the same thing with BasicQuery But still the same issue.
I want to get all the elements which are not resolved Is there any thing i should change so i can get all the elements based on query parameters.
Thanks in advance
Any help is deeply appreciated