728x90
Queries
Mongoose models provide several static helper functions for CRUD operations. Each of these functions returns a mongoose Query object.
- Model.deleteMany()
- Model.deleteOne()
- Model.find()
- Model.findById()
- Model.findByIdAndDelete()
- Model.findByIdAndRemove()
- Model.findByIdAndUpdate()
- Model.findOne()
- Model.findOneAndDelete()
- Model.findOneAndRemove()
- Model.findOneAndReplace()
- Model.findOneAndUpdate()
- Model.replaceOne()
- Model.updateMany()
- Model.updateOne()
A mongoose query can be executed in one of two ways. First, if you pass in a callback function, Mongoose will execute the query asynchronously and pass the results to the callback.
A query also has a .then() function, and thus can be used as a promise.
'코딩' 카테고리의 다른 글
mongo db 명령어 (0) | 2021.12.03 |
---|---|
Model (0) | 2021.12.01 |
Schema Types, String, Number, Date, ObjectId (0) | 2021.11.30 |
github Desktop 이용법 /static website hosting (0) | 2021.10.13 |
SPA(Single Page Application) (0) | 2021.10.06 |