Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8192631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:13:23+00:00 2026-06-07T04:13:23+00:00

I am reading the book MongoDB in Action . I have a question about

  • 0

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

product_1

product_2

Category

category_1
category_2


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:

two queries

  1. What does => mean? I thought => only exists in Ruby driver
    usage.

  2. What is the category in category['_id']? Is it a collection?

  3. What is the product in product['category_ids']?

  4. 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:13:24+00:00Added an answer on June 7, 2026 at 4:13 am

    It does look like the author is using a driver’s language other than the native MongoDB javascript mongo client. Also it would make sense since the book description says the author maintains both the C and Ruby Mongo drivers.

    1. Yes the => is a language driver specific notation. Not javascript. Seems to be just like saying: db.products.find({_id: aCategoryId}). Its actually a Ruby Hash notation.

    2. The category in that example looks to represent just a category document that you have already retrieved. In this case, it would have been the doc for the Gardening Category. Its just saying “find all products where this category id is in the products category_ids array

    3. Similar to the previous question. product is a document you have retrieved already. The query is saying “find any category doc where its id is IN this products array of category ids.

    4. category would be the Gardening Category if you had retrieved it with something like: var category = db.category.findOne({slug: "gardening-tools"})

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading the book of Windows via C/C++. In chapter 8, page
While reading a book about JavaScript I stumbled across an example: var names =
I'm reading a book about data structures in java, and it's talking about iterators
I'm reading the book Data Communications and Networking 4th Edition Behrouz-Forouzan . I have
Recently i'm reading the book Operating System Concepts Chapter VI about critical section problem,
Ok I am new to MongoDB and been reading a book about it, some
Recently, I was reading book about Erlang which has hot deployment feature. The deployment
Reading a book I have found the following statement: (Object) Behaviors answer either of
I'm reading the book 'Beginning F#', There's a short list for example code, to
I am reading some book and I have encountered a piece of code that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.