Dialog in console, product of functions in Node.js


I would like to know the reason that this dialogue takes, or why it is shown.


"(node: 16232) DeprecationWarning: collection.count is deprecated, and   will be removed in a future version. Use collection.countDocuments or   collection.estimatedDocumentCount instead "

While doing some functions of publication creations for a web application, I found this dialog in my terminal, but until now I have not found the reason, and if it affects.

asked by Keegan_Mtz 23.11.2018 в 00:36

1 answer


Warning does not come from NodeJs or Express, it comes from MongoDB, that's why you did not find it, you looked where it was not.

Surely, you are doing a 'count ()' in one of your functions of your code to check the database for the number of elements and what the MongoDB driver does is to warn you that future versions will eliminate or not give Support that method to support 'countDocuments ()'. This change is being applied since the last version of MongoDB, the 4.0

Therefore, check your code and replace the method so that you do not have problems in the future.


I hope I have helped you.


answered by 25.11.2018 / 16:55