node-casbin / mongoose-adapter

Mongoose adapter for Casbin
https://github.com/casbin/node-casbin
Apache License 2.0
33 stars 32 forks source link

Deprecation warning - ensureIndex is deprecated. #51

Closed sapcik closed 2 years ago

sapcik commented 2 years ago

Hi,

I'm getting following warning:

(node:42970) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. at NativeCollection. [as ensureIndex] (/project/node_modules/casbin-mongoose-adapter/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:244:33) at NativeCollection.create (/project/node_modules/casbin-mongoose-adapter/node_modules/mongoose/lib/model.js:1753:33)

Here is a list of libraries that I'm using:

  1. casbin: "^5.11.5",
  2. casbin-mongoose-adapter: "^3.1.1",
  3. mongoose: "^6.0.12",

Please, can it be upgraded to work with a newer version of mongoose/mongo?

As far as I understand, string ensureIndex should be replaced by createIndexes in lib/model.js

Thanks, Wojciech

casbin-bot commented 2 years ago

@Gabriel-403 @Zxilly @kingiw @nodece

hsluoyz commented 2 years ago

@fabian4

hsluoyz commented 2 years ago

@sapcik released: https://github.com/node-casbin/mongoose-adapter/releases/tag/v4.0.0

sapcik commented 2 years ago

Awesome, thank you!