Find all documents in a mongodb where the array fulfill a compound critiera

Viewed 13

I want to find all documents from a collection where the deliveryPrograms array fulfill the criteria e.g. contains (01A or 07A) and 02A ... My datastructure is something like:

_id: (ObjectId...)
dealerId: "1"
name: "Test 1"
programs: Array
  0: "01A"
  1: "07A"
  2: "02A"
  3: "99"
  4: "01B"

_id: (ObjectId...)
dealerId: "2"
name: "Test 2"
programs: Array
  0: "07A"
  1: "02A"
  2: "03C"
  3: "99"
  4: "01B"

The criteria is flexible so there can be a filter only on a program 01A or a complex filter on (01A or 07A) and 02A etc. Is it possible with org.springframework.data.mongodb.core.query.Criteria ?

0 Answers
Related