'fields' option is not working as expected in findAndModify

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 2.3.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • Iteration Hippocamp
    • Not Needed
    • Developer Tools

      Try running something like
      ```
      db.foo.findAndModify({
      query:

      { _id: 1 }

      ,
      fields:

      { foo: 0 }

      ,
      update: { $set:

      { foo: 4 }

      },
      });
      ```
      You'll see that foo is returned in the result of this query even if it is excluded via `fields`.

      See Slack channel thread here:
      https://mongodb.slack.com/archives/C0V2M1UH3/p1719607938376519
      Created with Jira Integration+ for gaurab.aryal (gaurab.aryal@mongodb.com)

              Assignee:
              Anna Henningsen
              Reporter:
              Gaurab Aryal
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: