How i can pass multiple parameters in mongodb
My current setup is like this:
const query = (...query) => {
let newQuery = query // this is an array
Model.findByIdAndUpdate(newQuery) // nothing happen coz the value is array
}
query(id, {name:'json bourne'})
I want to pass the all the parameters on the query. Thanks
The original query is this
Model.findByIdAndUpdate(id, { name: 'jason bourne' })
Is to pass the parameters like this
let newQuery =
id, { name: 'jason bourne'}// this will not work also it on get the first item which is id
Model.findByIdAndUpdate(newQuery)
{ id, name: 'json bourne'}?Model.findByIdAndUpdate(id, { name: 'jason bourne' })