flash-oss/node_acl

Missing index on `key` property on Mongodb

Closed this issue ยท 3 comments

I created an issue to the original repository just in case someone has the same issue. What was noticed is that the library creates an index

collection.createIndex({ _bucketname: 1, key: 1 }, (err) => {
and then in the case of the useSingle=false we are not using this index as we are querying with just the key meaning we are not using the index resulting to slow queries. Maybe the index could respect the useSingle flag and create the correct index.

var updateParams = this.useSingle ? { _bucketname: bucket, key: key } : { key: key };

Sound like a good idea.
Would you please a PR? We love PRs!

I am happy to ๐Ÿ˜„ , I will try to work on it today and send a pr

Thanks! Sorry for the delay. PR reviewed, merged, published as v2.0.1