Almost all methods in mongoose have callback functions, but the parameter information of the callback function cannot be found, so how can I find it?
天蓬老师2017-05-16 13:39:24
You should be able to find it if you check the documentation carefully. I don't use the mongoose driver so I'm not very familiar with it. The following information is for reference only:
http://mongoosejs.com/docs/qu...
Anywhere a callback is passed to a query in Mongoose, the callback follows the pattern callback(error, results). What results is depends on the operation: For findOne() it is a potentially-null single document, find() a list of documents, count() the number of documents, update() the number of documents affected, etc. The API docs for Models provide more detail on what is passed to the callbacks.
曾经蜡笔没有小新2017-05-16 13:39:24
mongsoose’s official documentation is quite clear. You can refer to the official documentation. For general query statements, the callback function has two attributes: error and document. The internal implementation of each module can be seen in the official documentation, so if you want to know how many parameters are passed in and how different parameters are processed, it is easy to check.