Mongoose save all parameters from request body

前端 未结 1 1140
难免孤独
难免孤独 2021-02-08 15:08

I\'m setting up a little API, I do some data validation on the client side of my application and whilst I do that I\'m structuring my data to match my mongoose schema.

I

相关标签:
1条回答
  • 2021-02-08 15:41

    You can pass the req.body to your Car like this

    var car = new Car(req.body);
    

    Here's also a reference: Passing model parameters into a mongoose model

    0 讨论(0)
提交回复
热议问题