-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.0
-
Component/s: Internal Code
-
Query Execution
-
ALL
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
- related to
-
CDRIVER-504 Convenient API to create BSON arrays
- Closed
-
SERVER-16814 Validate array keys in BSON documents
- Backlog