SoftwareBrothers / adminjs-mongoose

Mongoose adapter for AdminJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mongo deprecation warning

abdul-abdu opened this issue · comments

Describe the bug
(node:18614) DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use Collection.countDocuments or Collection.estimatedDocumentCount instead

Installed libraries and their versions
"@admin-bro/express": "^3.1.0",
"@admin-bro/mongoose": "^1.1.0",
"admin-bro": "^3.4.0",
"admin-bro-expressjs": "^2.1.1",
"bcryptjs": "^2.4.3",
"chart.js": "^2.9.4",
"cloudinary": "^1.25.1",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"ejs": "^3.1.6",
"express": "^4.17.1",
"express-formidable": "^1.2.0",
"express-list-endpoints": "^5.0.0",
"express-session": "^1.17.1",
"json2csv": "^5.0.6",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.11.19",
"multer": "^1.4.2",
"multer-storage-cloudinary": "^4.0.0",
"nodemailer": "^6.5.0",
"query-to-mongo": "^0.10.1",
"react-chartjs-2": "^2.11.1",
"stripe": "^8.142.0",
"swagger-ui-express": "^4.1.6",
"tslib": "^2.1.0"

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'console'
  2. Click on 'open admin'
  3. See error

AdminBroOptions with schema

const AdminBro = require("admin-bro");
const { buildAuthenticatedRouter } = require("@admin-bro/express");
const AdminBroMongoose = require("@admin-bro/mongoose");
const UserModel = require("../models/userModel");
const AdminBroOptions = require("./options");

AdminBro.registerAdapter(AdminBroMongoose);

const adminBro = new AdminBro(AdminBroOptions);

const adminRouter = buildAuthenticatedRouter(adminBro, {
cookieName: "admin-bro",
cookiePassword: "secret password",
authenticate: async (email, password) => {
const user = await UserModel.findByCredentials(email, password);
return user;
},
});

module.exports = adminRouter;

Desktop (please complete the following information if relevant):

  • OS: linux
commented

Bump on this

This should be fixed