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

when sent invalid BSON, server runs one thing and prints another in the logs

    XMLWordPrintable

    Details

    • Operating System:
      ALL

      Description

      Due to CDRIVER-504 my code managed to send the following pipeline BSON to the server:

      { "0" : { "$unwind" : { "includeArrayIndex" : "a_idx", "path" : "$a" } }, "0" : { "$match" : { "a.b" : { "$lt" : 3 } } }, "0" : { "$project" : { "a.b" : 1, "a_idx" : 1, "_id" : 0 } } }
      

      This is not technically valid (SERVER-16814) but it's accepted and run. This ticket is about the fact that what server runs is just the last stage, but what it logs into server logs is a correct looking pipeline:

      This is debugging output showing the only document in the collection returned unwounded and unfiltered (but with project applied):

      fetched row { "a" : [ { "b" : 1 }, { "b" : 2 }, { "b" : 3 } ] }
      

      This is the corresponding log line:

      2015-12-18T07:39:53.058-0800 I COMMAND  [conn181] command test.test3 command: aggregate { aggregate: "test3", pipeline: [ { $unwind: { includeArrayIndex: "a_idx", path: "$a" } }, { $project: { _id: 1, a.b: 1, a_idx: 1 } } ], cursor: {}, allowDiskUse: true } ntoskip:0 keyUpdates:0 writeConflicts:0 numYields:0 reslen:470 locks:{ Global: { acquireCount: { r: 6 } }, Database: { acquireCount: { r: 3 } }, Collection: { acquireCount: { r: 3 } } } protocol:op_query 0ms
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-execution Backlog - Query Execution
              Reporter:
              asya Asya Kamsky
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: