Problem with Projection

XMLWordPrintableJSON

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

      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 Hackett
            Reporter:
            Lưu Đạt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: