How do i query any objects whos array contains a player with a matching case-insensitive name? db.collection.find(players.name: search)
This is a example object of how the data is stored (I've removed all irrelevant fields to the question).
{ "_id" : ObjectId("5d67f29ae6504b451c3aca3e"), "players" : [
{ "name" : "Jenny"}, { "name" : "Benny"}, { "name" : "Kenny" } ] }
One solution would be to just iterate through all documents in the collection and then in turn iterate through all names in each document but I'm trying to avoid this. Another is perhaps to map names to objectIds?