I'm trying to update a user's shipping information. I have default data in mongodb that I'm trying to overwrite with a PATCH/PUT. Right now postman hangs indefinitely. The mongoose model has the values, my else{} statement outputs the JSON object to be submitted with no error, but it never goes through. I appreciate any help. POSTMAN
Could not get any response
app.js
app.put('/api/users/:id', (req, res) => {
User.findByIdAndUpdate({ _id: req.params.id },
{
fullName: req.body.fullName,
address1: req.body.address1,
address2: req.body.address2,
city: req.body.city,
state: req.body.state,
zip: req.body.zip
}, function (err, docs) {
if (err) res.json(err);
else {
// console.log(docs)
}
});
})
MODEL
const mongoose = require("mongoose");
const shippingSchema = mongoose.Schema({
fullName: { type: String},
address1: { type: String },
address2: { type: String },
city: { type: String },
state: { type: String},
zip: { type: String}
});
module.exports = mongoose.model("Shipping", shippingSchema);