_addSpecial() flags not used by DBCollection.getCount() method eg collection.find()._addSpecial().count()

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Blocker - P1
    • None
    • Affects Version/s: 2.2.0
    • Component/s: Querying
    • None
    • Environment:
      Linux CentOS/RHEL, Mac OSX
    • ALL
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      We tag each query for profiling using _addSpecial and $comment:

      db.test.find(

      {field:"value"}

      )._addSpecial("$comment", "[COMMENT]")

      These show up correctly in the logs and db.currentOp() when using collection.find() method.

      But any flags added via _addSpecial are not used by the collection's getCount() method. We use the count method to display a query's total count:

      db.test.find(

      {field:"value"}

      ).count()
      db.test.find(

      {field:"value"}

      )._addSpecial("$comment", "[COMMENT]").count()

      The .count() disregards any special flags, so profiling/tracing/db.currentOp() do not show our unique tag for that query.

      Based on the source code, the DBCollection.getCount() method does not accept any special flags parameters, so it looks like a core server issue.

      See attached console session, where a .find()._addSpecial shows the $comment via db.currentOp(), but it is not displayed when I issue a .find()._addSpecial().count()

            Assignee:
            Aaron Staple (Inactive)
            Reporter:
            Joe Davis
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: