Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-259

find_and_modify + field returns nothing but _id

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.11
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None

      Description

      >>> test = pymongo.Connection().test.test
      >>> test.insert(

      {'a': 1}

      )
      ObjectId('4e0509dce4721c2217000000')

      >>> test.find_and_modify({}, {'$inc': {'a': 1}})

      {u'a': 1, u'_id': ObjectId('4e0509dce4721c2217000000')}

      >>> test.find_and_modify({}, {'$inc': {'a': 1}}, fields=['a'])

      {u'_id': ObjectId('4e0509dce4721c2217000000')}

      As soon as you pass a `fields` option only the _id field is returned.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: