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

Mistake in Projection doc

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • v1.3.10
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None

      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 } )
      

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

              Created:
              Updated:
              Resolved:
              9 years, 36 weeks, 6 days ago