Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-9863

Incorrect $elemMatch query

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      https://docs.mongodb.com/manual/tutorial/query-array-of-documents/#combination-of-elements-satisfies-the-criteria

      The second query

      should be

      db.inventory.find( { "instock":

      { qty: 60, warehouse: "A" }

      } )

      instead of

      db.inventory.find( { "instock": { $elemMatch:

      { qty: 60, warehouse: "A" }

      } } )

      Attachments

        Activity

          People

            kay.kim@mongodb.com Kay Kim (Inactive)
            Sagar Sagar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 1 week, 2 days ago