Query nested objects in a document with unknown key

Hi @Wolfspirit,

Have you considered using a text index where you will index all items like { 'items.$**' : "text" }

Than query :

 db.stores.find( { $text: { $search: "On" } } )

Or aggregate with text search and later on filter with $map.

Thanks
Pavel

1 Like