All,
I am very new to mongodb and python. I tried to write a redact query but having issue. It works in Mongo Shell but not in python. Can someone help? TIA
userAccess = [ "deserunt sint cupidata" ,"dolore pariatur aliqua","eu magna cupidatat dolore","amet irure nulla"]
cursor = coll.name.aggregate(
[
{ "$redact": {
"$cond": {
"if": { '$gt':
[
{ "$size":
{ "$setIntersection":
[ "$tags", userAccess ]
} }, 0 ]
},
then: "$$DESCEND",
"else": "$$PRUNE"
}
}
}
]
)
for x in cursor:
print(x)