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

Redact pipeline not including non-object array members

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.3
    • Affects Version/s: 2.5.2
    • Component/s: Aggregation Framework
    • None
    • Minor Change
    • ALL
    • Hide

      t = db.jstests_aggregation_redact;
      t.drop();
      t.save(
      {
      _id: 1,
      level: 2,
      subobj: {
      level: 3,
      text: "level 3 secret",
      subarray: [

      { text: "I'm an object with no level" }

      ,

      { level: 1, text: "I'm an object with acceptable level"}

      ,

      { level: 100, text: "I'm an object with unacceptable level"}

      ,
      "I'm not an object",
      10
      ],
      subobj:

      { level:1, text: "level 3 secret due to inheritance" }

      },
      secretLevel2: 9,
      text: "level 2 secret"
      }
      );
      t.aggregate({$redact: {$cond: [{$lte: ['$level', 3]}, "$$CONTINUE", "$$PRUNE"]}});

      Show
      t = db.jstests_aggregation_redact; t.drop(); t.save( { _id: 1, level: 2, subobj: { level: 3, text: "level 3 secret", subarray: [ { text: "I'm an object with no level" } , { level: 1, text: "I'm an object with acceptable level"} , { level: 100, text: "I'm an object with unacceptable level"} , "I'm not an object", 10 ], subobj: { level:1, text: "level 3 secret due to inheritance" } }, secretLevel2: 9, text: "level 2 secret" } ); t.aggregate({$redact: {$cond: [{$lte: ['$level', 3] }, "$$CONTINUE", "$$PRUNE"]}});

      jstest example indicate that non-object members of arrays undergoing redaction should be included in field-level filtered results.
      https://github.com/mongodb/mongo/blob/master/jstests/aggregation/bugs/server8581.js

      Asserts in this test don't test for the inclusion of the:
      "NOT AN OBJECT!!11!" // always included when b is included
      line in the results of a level 3 redaction

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            david.erickson David Erickson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: