I have a collection with first name, last name and birth year.
[
{
"firstName": "John",
"lastName": "Smith",
"birthYear": 1990
},
{
"firstName": "Jane",
"lastName": "Smith",
"birthYear": 1989
},
{
"firstName": "John",
"lastName": "Doe",
"birthYear": 1990
},
{
"firstName": "Jane",
"lastName": "Doe",
"birthYear": 1990
}
]
And I trying to find records with birthYear=1990 and ((firstName=John AND lastName=Smith) or (firstName=Jane AND lastName=Doe)).
The result I want is the following
[
{
"firstName": "John",
"lastName": "Smith",
"birthYear": 1990
},
{
"firstName": "Jane",
"lastName": "Doe",
"birthYear": 1990
}
]
Is there a way to do this using spring-data-mongodb's Query and Criteria?