Open JinYuSha0 opened 2 years ago
That's how I solved it for now
async function loadEnforcer() {
const model = path.resolve(__dirname, "../config/rbac_model.conf");
const adapter = await MongoAdapter.newAdapter({
uri: process.env.DATABASE_URL,
option: {
useNewUrlParser: true,
},
database: process.env.DATABASE_NAME,
collection: "casbin",
});
await adapter.mongoClient.connect();
const e = new Enforcer();
await e.initWithAdapter(model, adapter, true);
adapter.mongoClient.isConnected = true;
await e.loadPolicy();
return e;
}
@JinYuSha0 can you make a PR to fix it?
@juicycleff
@JinYuSha0 can you make a PR to fix it?
I can offer a PR as early as tomorrow
Updating this package soon
anyone wants to be added as a contributor please let me know
see https://github.com/mongodb/node-mongodb-native/commit/5a37a9244aa8a3ca0ce137c42f6593d99aca98ee
and then will throw error: Casbin mongo adapter not connected