I am reading the book MongoDB in Action. I have a question about Chapter 4: Document-oriented data
.
On Page 58
, the book gives an example for many-to-many relations. It gives Product
document and Category
document.
Product
Category
My question
I understand the many-to-many association here. Basically, Product
can have a key with array of Category
_id, etc. So I am not trying to ask a question like this MongoDB Many-to-Many Association
My question is about Page 61
, where the book gives two example queries about querying the many-to-many relations. Here is the two queries:
What does
=>
mean? I thought=>
only exists in Ruby driver usage.What is the
category
incategory['_id']
? Is it a collection?What is the
product
inproduct['category_ids']
?How is the first query related to
Gardening Tools category
as described above the first query?
The book doesn't explain these two queries in details.
Can someone explain more about querying for many-to-many?