DeprecationWarning: collection.count is deprecated
See original GitHub issueI use Node v8.11.1 and these packages:
"mongoose": "^5.2.2",
"mongoose-paginate": "^5.0.3"
And this get this warning during execution of paginate()
:
(node:9893) DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use collection.countDocuments or collection.estimatedDocumentCount instead
Issue Analytics
- State:
- Created 5 years ago
- Reactions:18
- Comments:12
Top Results From Across the Web
mongodb-nodejs-driver, DeprecationWarning: collection.count ...
As you figured out, starting from MongoDB Node.JS driver v3.1 the count() method has been deprecated and will be replaced with : Collection....
Read more >DeprecationWarning: collection.count is deprecated #6831
The underlying mongodb driver has deprecated the .count() method. You should use .estimatedDocumentCount() or .countDocuments() instead.
Read more >count is deprecated. Use Collection.count_documents instead ...
py:2: DeprecationWarning: count is deprecated. Use Collection.count_documents instead. after executing: movies.find( { “cast”: “Salma Hayek” } ) ...
Read more >Mongoose v6.8.2: Deprecation Warnings
DeprecationWarning : collection.count is deprecated, and will be removed in a future version. Use collection.countDocuments or collection.
Read more >collection.count is deprecated, and will be removed in a future ...
nodejs操作mongodb 用db.collection(collectionName).count(json)报错如下: nodejs操作mongodb报错(node:664) DeprecationWarning: collection.count is deprecated, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem. I have forked the project (from version-5.0.3) to fix the warning.
npm install git://github.com/zerok78/mongoose-paginate.git#version-5.0.4 -S
Same problem here and because I’m not sure if there will be any update here, I have created small service on base this library, used in schema on the same principle but return promise and using only page, sort and limit, maybe it will help -