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

Legacy query via mongos drops $comment

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.2, 3.5.2
    • Affects Version/s: 3.4.0
    • Component/s: Querying
    • Labels:
      None
    • Major Change
    • ALL
    • v3.4, v3.2
    • Hide

      1. Spin up a 3.4 sharded cluster
      2. Connect to a mongos with a 3.0.x shell, or use db.getMongo().forceReadMode("legacy")
      3. Issue a find with a comment, e.g. db.coll.find({...}).comment("TESTCOMMENT")
      4. Examine the resulting operation in currentOp or the profiler/logs

      Show
      1. Spin up a 3.4 sharded cluster 2. Connect to a mongos with a 3.0.x shell, or use db.getMongo().forceReadMode("legacy") 3. Issue a find with a comment, e.g. db.coll.find({...}).comment("TESTCOMMENT") 4. Examine the resulting operation in currentOp or the profiler/logs
    • Query 2017-01-23

      When a legacy query is issued to a mongos with a $comment meta-operator attached, the comment will be dropped before the query is forwarded. This is because the query is transformed to a find command for the shards, but the $comment field is not parsed from the original legacy object and is therefore not added to the final command. A legacy query on a mongod retains the comment since no transformation occurs. This behaviour has been present since 3.2.

            Assignee:
            bernard.gorman@mongodb.com Bernard Gorman
            Reporter:
            bernard.gorman@mongodb.com Bernard Gorman
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: