countDocuments: $geoNear, $near, and $nearSphere are not allowed in this context

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Using the query in countDocuments() in the code below causes this error: "
      MongoError: $geoNear, $near, and $nearSphere are not allowed in this context".
      It doesn't happen when using the same query in count(). Since countDocuments() deprecates count() I thought this might be a bug.
       
      Full repro: https://pastebin.com/WSEgM7X1
       
      Using node 8.15.0, mongodb package 3.1.12 and mongodb server 4.0.3 locally as replicaset.
       
       

            Assignee:
            Unassigned
            Reporter:
            Christiaan Maks
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: