search

Home  >  Q&A  >  body text

node.js - Regarding the parameters of the callback function of the mongoose method, how to know the number of parameters and what they mean?

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?

某草草某草草2748 days ago581

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师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.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:39:24

    1. See the documentation

    2. Using TypeScript:

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新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.

    reply
    0
  • Cancelreply