Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1812

MongoCollection.Count() is not correct

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.0-beta1
    • Component/s: Operations
    • Labels:
      None

      var cursor = mongoCol.FindAllAs<BsonDocument>()
      .SetSkip(currentDataViewInfo.SkipCnt)
      .SetLimit(currentDataViewInfo.LimitCnt);

      the SkipCnt and LimitCnt is 0.

      var dataList = cursor.ToList();
      // the Length of datalist is 2;

      var CurrentCollectionTotalCnt = (int)mongoCol.Count(); //CurrentCollectionTotalCnt is 1

      //Test Record is below

      /* 1 */
      {
      "_id" :

      { "$oid" : "58105ee802f2b624c09971bb" }

      ,
      "loc" :

      { "type" : "Point", "coordinates" : [-73.97, 40.77] }

      ,
      "name" : "Central Park",
      "category" : "Parks"
      }
      /* 2 */
      {
      "_id" :

      { "$oid" : "58105ef902f2b624c09971bc" }

      ,
      "loc" :

      { "type" : "Point", "coordinates" : [-73.88, 40.78] }

      ,
      "name" : "La Guardia Airport",
      "category" : "Airport"
      }

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            MagicHu Hu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: