Post Request and mongo isuue





When I try to post a book data using Postman, it throws an error

Why does this happen? Can you give me the correct flow of a POST request? ,the POST request gives an error.

Hi @kaushik,

Can you try sending your payload as a json {
“isbn”: “978-1234567890”,
“title”: “Book One”,
“author”: “Author A”,
“publishedYear”: 2020
} and selecting raw instead of x-www-form-urlencoded

I connected through the MongoDB Atlas connection URL, which is working fine, but I am still getting a 400 error.

Hello @kaushik ,
Make sure the headers are set to application/json. In the MongoDB document node, add bh.input.body directly if you’re not storing the object in a variable




same error, here i attach all the screen short about work flow.
did you find any mistake here





same error, here i attach all the screen short about work flow.
did you find any mistake here

Hello @kaushik , You don’t need to manually write bh.input in the Document in mongo node. Instead, just select bh.input and add body there. Also, make sure to change the headers in Postman to application/json so that the body is received as JSON.


same error

Hello @kaushik ,
Please make proper normal quotes, now it seems like you are using curly quotes.

Hello, good morning. Here I am sharing my MongoDB configuration. I also added a log node. In the log node, the data is displayed correctly using console.log (showing the JSON data), but in MongoDB the data is not being saved properly it only creates a new ID for the record without storing the actual data.



Why is this happening? When I send data through Postman, I add the header and pass the data in JSON format. Postman gives a response with only the object ID.
eg
{
“acknowledged”: true,
“insertedId”: “68b6609af5c00061278e5afd”
}

Hello @kaushik ,Please double-check your database collection to confirm whether the data is stored or not.