title: MongoDB connect 400 error message on postman
body: <p>I'm new to mongoDB using Node. Unfortunately, I use postman and got 400 error, While connection to MongoDB. my env file is exist:
  DB_CONNECT = mongodb+srv://Hadar:******@cluster.r5qw9.mongodb.net/User?retryWrites=true&amp;w=majority
  Make sure the user and password both are correct.</p>
  <p><a href="https://i.stack.imgur.com/PvJrU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PvJrU.png" alt="enter image description here" /></a>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const mongoose = require('mongoose')
  
  const userSchema = new mongoose.Schema({
      name:{
          type: String,
          required: true,
  
      },
      password:{
          type:String,
          required:true,
      }
  })
  
  module.exports = mongoose.model('User',userSchema)</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const express = require('express')
  const app = express()
  const mongoose = require('mongoose')
  const dotenv = require('dotenv')
  dotenv.config()
  //connect to DB
  mongoose.connect(process.env.DB_CONNECT,
  () =&gt; console.log('connect to DB'))
  
  app.use(express.json())
  
  //import routes
  const authRoutes = require('./routes/auth')
  
  //Router Middlewares
  app.use('/api/user',authRoutes)
  app.listen(5000, ()=&gt;{console.log('Server is up and running')})</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const router = require('express').Router();
  const User = require('../model/User')
  
  router.post('/Login', async (req,res) =&gt;{
      const user = new User({
          name: req.body.name,
          password: req.body.password
      });
      try{
          const savedUser = await user.save();
          res.send(savedUser);
      }catch(err){
          res.status(400).send(err);
      }
  })
  
  module.exports = router;</code></pre>
  </div>
  </div>
  </p>