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

Migrating obsolete "Count" to new methods has a problematic cost

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      I'm tasked with cleaning up the warnings for our C# Framework 4.8 project and I'm running into difficulties with resolving obsolete warnings for the Mongo Driver.

      The problem is "Count is obsolete. Use CountDocuments" instead. But that's problematic as `CountDocuments` is slower (see linked Issue NODE-1638). That's not an option for us, as we're already having into performance issues. Thus, like the answer to that issue suggests, we would prefer to use `EstimatedDocumentCount`. But that doesn't seem to be a drop-in replacement! `EstimatedDocumentCount` doesn't take a `filter` argument.

      Second problem is that `IFindFluent.Count` is also showing the obsolete warning. But IFindFluent doesn't even have a `EstimatedDocumentCount` alternative.

      So how do I solve this? We want to update, but don't want a performance impact. Our customers are already complaining.

      (And I'm not even talking about the "when migrating from Count to CountDocuments the following query operations must be replaced" part. Breaking changes are high risk for business logic.)

            Assignee:
            james.kovacs@mongodb.com James Kovacs
            Reporter:
            jochem@netwinst.nl Jochem Bonarius
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: