I'm trying to create a Criteria List from .mongodb.core.query.Criteria in spring app with mongoRepository and I've stucked with an issue where I have Customer object with two fields - "name" and "surname" - and I need to create "or" query looking somehow like this:
criteria.add(new Criteria().orOperator(
Criteria.where("customerName").regex(stringData),
Criteria.where("customerSurname").regex(stringData),
Criteria.where("customerData.name","customerData.surname").regex(stringData)
))
So if the stringData was "Alex" i would get objects
[{name: "Alex", surname: "Ich"}, {name: "Agatha", surname: "Alex"}], but if I would type "Agatha Alex" i would get object [{name: "Agatha", surname: "Alex"}] as a result. Could someone push me into the right direction how to this out?