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

Mistake in Projection doc

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • v1.3.10
    • None
    • manual
    • None

    Description

      url: http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/

      in "Projection for Array Fields," it has the text: "The $elemMatch and $slice projection operators are the only way to project portions of an array."

      This is not true; you can use dot notation. Run the following in the shell:

      db.foo.insert( { a : [5, 6, 7, 8], b : [ 11, 12, 13, 14] } )
      db.foo.find( { "a.2": 7 }, { _id : 0 , "a.$": 1 } )

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              9 years, 26 weeks, 1 day ago