From db0b67ca9ceccdb43e342f9959ff02d856cb2d6f Mon Sep 17 00:00:00 2001 From: Tyler Brock Date: Fri, 4 Sep 2020 08:46:47 -0700 Subject: [PATCH] Dedupe direct/child roles in Auth pipline --- src/Auth.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Auth.js b/src/Auth.js index 49934f1b756..2361c0b76dc 100644 --- a/src/Auth.js +++ b/src/Auth.js @@ -257,9 +257,15 @@ Auth.prototype._generateRoleGraphPipeline = function () { }, }, }, + { + $group: { + _id: { name: '$name' }, + }, + }, { $project: { - name: 1, + _id: 0, + name: '$_id.name', }, }, ], @@ -284,9 +290,15 @@ Auth.prototype._generateRoleGraphPipeline = function () { }, }, }, + { + $group: { + _id: { name: '$name' }, + }, + }, { $project: { - name: 1, + _id: 0, + name: '$_id.name', }, }, ],