diff --git a/source/reference/projection/elemMatch.txt b/source/reference/projection/elemMatch.txt index 4e2e72976b4..ad367ba0ed4 100644 --- a/source/reference/projection/elemMatch.txt +++ b/source/reference/projection/elemMatch.txt @@ -35,9 +35,8 @@ $elemMatch (projection) .. code-block:: javascript - db.students.find( { zipcode: 63109 }, - { _id: 0, - dependents: { $elemMatch: { school: 102 } } } ) + var projection = { _id: 0, dependents: { $elemMatch: { school: 102 }}}; + db.students.find( { zipcode: 63109 }, projection); The query would return all documents where the value of the ``zipcode`` field is ``63109``, while the projection excludes