Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

68
Views
postman does not store value

So I am trying to enter a post using postman into a mongo db server but my post just returns empty. When I look into my server nothing has been entered and there is no error

Route file

router.post('/', async (req,res) => {
const post = new customer({
    fullName: req.body.fullName,
    id: req.body.id
});
try{
    const savedCust = await customer.save();
    res.json(savedCust);
} catch (err) {
    res.json({message: err});
}
});

module.exports = router;

This is what I submit on postman:

{
    "fullName" : "Tim Scott",
    "id": 87438
}

And this is the response that I get back:

{
    "message": {}
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The error said that customer.save() isn't a function. This happened in your try {...} block inside your route file. The reason for that is that it's not a function. You should be doing post.save():

// route file
const express = require('express');
const router = express.Router();
const customer = require('../models/customer');
router.post('/', async (req,res) => {
  const post = new customer({
    fullName: req.body.fullName,
    id: req.body.id
  });
  try {
    const savedCust = await post.save(); // right here
    res.json(savedCust);
  } catch (err) {
    res.json({message: err});
  }
});

module.exports = router;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!