node.js - Regarding the parameters of the callback function of the mongoose method, how to know the number of parameters and what they mean?
某草草
某草草 2017-05-16 13:37:24
0
3
583

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?

某草草
某草草

reply all(3)
Peter_Zhu

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.

洪涛
  1. See the documentation

  2. Using TypeScript:

曾经蜡笔没有小新

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template