i have some embedded documents. Company -> Stand -> Product. Document product have field "tag". I can do this request very well: Company.where("stands.products.tags" => "books")
. But I want to find with two tag names, for example, Company.where("stands.products.tags" => "books").where("stands.products.tags" => "toys")
. But in this example mongo will find only "toys tags". How I can find more tags in one request?
I suggest you refactor your tags
attribute into an array of strings, index them and then have a look at this helpful method
Company.any_in("stands.products.tags" => ["books", "toys"])