Commit 20d3b8e2 authored by Vadym Gidulian's avatar Vadym Gidulian

Fixed putting of records using Mongo ObjectID as `_id`

parent fa98e12d
{ {
"name": "storage-mongo-node", "name": "storage-mongo-node",
"version": "1.0.1", "version": "1.0.2",
"dependencies": { "dependencies": {
"express": "^4.16.2", "express": "^4.16.2",
......
...@@ -61,7 +61,7 @@ app.put('/:collection/:id', (req, res) => { ...@@ -61,7 +61,7 @@ app.put('/:collection/:id', (req, res) => {
return; return;
} }
collection.insertOne({...req.body, _id: req.params.id}, (err, result) => { collection.insertOne({...req.body, _id: wrapId(req.params.id)}, (err, result) => {
if (err) throw err; if (err) throw err;
const record = result.ops[0]; const record = result.ops[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment