Closed idanyadgar closed 6 years ago
As of MongoDB Node.JS driver version 3.1, collection.count is deprecated (http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#count)
This causes a deprecation warning when the validator runs: DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use collection.countDocuments or collection.estimatedDocumentCount instead
DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use collection.countDocuments or collection.estimatedDocumentCount instead
Used here: https://github.com/CampbellSoftwareSolutions/mongoose-id-validator/blob/c0fcb87cadd9a1b15584afbe323c49cbac1a96ee/lib/id-validator.js#L111 And here: https://github.com/CampbellSoftwareSolutions/mongoose-id-validator/blob/c0fcb87cadd9a1b15584afbe323c49cbac1a96ee/lib/id-validator.js#L131
Should change implementation to use collection.countDocuments or collection.estimatedDocumentCount.
collection.countDocuments
collection.estimatedDocumentCount
I just made a PR for this change from count() to countDocuments()
count()
countDocuments()
@kirkle, thanks. v0.5.0 now published with this change.
As of MongoDB Node.JS driver version 3.1, collection.count is deprecated (http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#count)
This causes a deprecation warning when the validator runs:
DeprecationWarning: collection.count is deprecated, and will be removed in a future version. Use collection.countDocuments or collection.estimatedDocumentCount instead
Used here: https://github.com/CampbellSoftwareSolutions/mongoose-id-validator/blob/c0fcb87cadd9a1b15584afbe323c49cbac1a96ee/lib/id-validator.js#L111 And here: https://github.com/CampbellSoftwareSolutions/mongoose-id-validator/blob/c0fcb87cadd9a1b15584afbe323c49cbac1a96ee/lib/id-validator.js#L131
Should change implementation to use
collection.countDocuments
orcollection.estimatedDocumentCount
.