Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7110

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Blocker - P1 Blocker - P1
    • None
    • 2.2.0
    • Querying
    • None
    • Linux CentOS/RHEL, Mac OSX
    • ALL

    Description

      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()

      Attachments

        Activity

          People

            aaron Aaron Staple
            joe.davis@servicenow.com Joe Davis
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: