title: The 'updateOne' method does not work. In the 'if' statement it returns in error - Angular , Mongo
body: <p>The <strong>updateOne</strong> method does not work. In the <strong>if</strong> statement it returns in error:</p>
  
  <p>server.js:</p>
  
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const path = require('path');
  const http = require('http');
  const app = express();
  
  const MongoClient = require('mongodb').MongoClient;
  const ObjectID = require('mongodb').ObjectID;
  
  const connection = (closure) =&gt; {
   return MongoClient.connect('mongodb://localhost:27017/mean', (err, client) =&gt; {
       if (err) return console.log(err);
       let db = client.db('mean');
       closure(db);
   });
  };
  
  let response = {
   status: 200,
   data: [],
   message: null
  };
  
  const api = require('./server/routes/api');
  
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false}));
  app.use(express.static(path.join(__dirname, 'dist')));
  
  app.use('/api', api);
  
  app.get('*', (req, res) =&gt; {
      res.sendFile(path.join(__dirname, 'dist/index.html'));
  });
  
  app.put("/api/product/:id", (req, res) =&gt; {
      console.log('app.put ');
        var updateDoc = req.body;
        delete updateDoc._id;
        console.log(updateDoc);
        connection((db) =&gt; {
  
            db.collection('product').updateOne({_id: new ObjectID(req.params.id) }, updateDoc, (err, doc) =&gt; {
              console.log('app.put');
              if (err) {
                  console.log('app.put error: ');
                  console.log(err);
  
              } else {
                  console.log('app.put ok');
                  updateDoc._id = req.params.id;
                  res.status(200).json(updateDoc);
              }
            });
        });
      });
  
  const port = process.env.PORT || '3000'; 
  app.set('port', port);
  
  const server = http.createServer(app);
  server.listen(port, () =&gt; console.log(`Running on localhost:${port}`));
  </code></pre>
  
  <p>in the console displays such an error:</p>
  
  <pre><code>path_to_the_project_directory&gt;node server
  Running on localhost:3000
  app.put
  { name: 'testzzz' }
  app.put
  app.put error:
  { MongoError: the update operation document must contain atomic operators.
      at Function.MongoError.create (path_to_the_project_directory\node_modules\mongodb-core\lib\error.js:45:10)
      at toError (path_to_the_project_directory\node_modules\mongodb\lib\utils.js:149:22)
      at checkForAtomicOperators (path_to_the_project_directory\node_modules\mongodb\lib\collection.js:848:12)
      at Collection.updateOne (path_to_the_project_directory\node_modules\mongodb\lib\collection.js:822:13)
      at connection (path_to_the_project_directory\server.js:74:30)
      at MongoClient.connect (path_to_the_project_directory\server.js:18:6)
      at args.push (path_to_the_project_directory\node_modules\mongodb\lib\utils.js:404:72)
      at path_to_the_project_directory\node_modules\mongodb\lib\mongo_client.js:255:5
      at connectCallback (path_to_the_project_directory\node_modules\mongodb\lib\mongo_client.js:933:5)
      at path_to_the_project_directory\node_modules\mongodb\lib\mongo_client.js:794:11
    name: 'MongoError',
    message: 'the update operation document must contain atomic operators.',
    driver: true }
  </code></pre>
  
  <p>What is the reason for the error?
  I do not know what's wrong with the <strong>updateOne</strong> method. I added wrong parameters in the <strong>updateOne</strong> method?</p>
  
  <p>The data in the <strong>Mongo</strong> database does not edit.</p>