Skip to content

Updated mongodb and applied deprecated `count` changes

Pre-release
Pre-release
Compare
Choose a tag to compare
@trapcodeio trapcodeio released this 10 Mar 09:26
· 59 commits to v2 since this release

The new mongodb v 4.4.0 to be exact deprecated collection.count() but this won't be a breaking change for us as the new recommended countDocuments and estimatedDocumentCount has been applied.

Model.count(filter?, options?) // is same as native().countDocuments()
Model.countEstimated() // is same as native().estimatedDocumentCount()

It is recommended you use count when you have a query filter and countEstimated when you have none.

Nevertheless xpress-mongo's count uses countEstimated when no query is provided.