juicycleff / casbin-mongodb-adapter

Pure MongoDB adapter for Casbin
MIT License
9 stars 14 forks source link

removePolicies, and removeGroupingPolicies not able to delete document actually #23

Open AlgerLin-Noodoe opened 9 months ago

AlgerLin-Noodoe commented 9 months ago

In my code, I try to delete a policies via casbin's removePolicies([["GROUP-1", "DOMAIN-A", "POLICY-A1", "ACT-BIND"], ...]), but this document not be deleted from database actually. I found the adapter calling the MongoDb deleteOne() function with current timestamp as below, but that document with different timestamp in my database, and that causes deleting failed.

{ createdAt: '2023-11-15T10:02:18.402Z', updatedAt: '2023-11-15T10:02:18.402Z', ptype: 'p', v0: 'GROUP-1, v1: 'DOMAIN-A', v2: 'POLICY_A1', v3: 'ACT-BIND' }

Please remove the timestamp from the deletion condition.

hsluoyz commented 9 months ago

@juicycleff

AlgerLin-Noodoe commented 9 months ago

The removeGroupingPolicies function with same issue also.