Home>
I have a question. I wrote the necessary parameters for the scheme (Mongo DB) field, then using the module send:
module.exports= model('Todo', schema);
Exported it, got it in another file
const Todo= require('../models/Todo')
And I now have a find method for Todo (or any others). But at the same time, scheme did not have any such methods, how did it happen that we just exported the variable, and it got new methods?
-
Answer # 1
-
Answer # 2
It's about
model
this is a function that inside itself makes the Todo model you need and also adds methods for working with the base.
Trends
- python - you may need to restart the kernel to use updated packages error
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to check the type of a shell script variable
- i want to call a child component method from a parent in vuejs
It's about
model
this is a function that inside itself makes the Todo model you need and also adds methods for working with the base.