Doctrine Mongodb Search in a hashed field

  doctrine-odm, php, symfony

I have a collection of books where each book has many categories.It looks like this:

{
    "_id" : 52,
    "reference" : "13168698",
    "title" : "PHP Code quality",
    "categories" : {
        "0" : "software",
        "1" : "php",
        "2" : "unit testing"
    },
    "createdAt" : ISODate("2020-08-14T07:03:16.000Z")
}

I want to be able to search for books by a single or multiple categories.

Source: Symfony Questions

LEAVE A COMMENT