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

Problem with Projection

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.11.3
    • Component/s: API
    • None
    • Environment:
      ubuntu 20.0.4, python 3.8, mongodb 4.4

      I think there is a problem with projection parameter in find() method

       

      client = MongoClient()
      filter={}
      project={}
      
      result = client['my_db']['my_collection'].find(
        filter=filter,
        projection=project
      )
      
      ##### It will return "_id" field of the documents only

      I also use the Mongo compass tool to generate this code. But it returns the full-fields results of documents for me, maybe it is due to the compatibility of this tool and pymongo

       

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            tad.louis2810@gmail.com Lưu Đạt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: