title: UnhandledPromiseRejectionWarning: MongoParseError: Invalid connection string
body: <p>when i am running my app.js file i am getting UnhandledPromiseRejectionWarning: MongoParseError: Invalid connection string.</p>
  <p>the whole error in my terminal is:</p>
  <p>$ node app.js
  (node:18676) UnhandledPromiseRejectionWarning: MongoParseError: Invalid connection string
  at parseConnectionString (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\core\uri_parser.js:565:21)
  at connect (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\operations\connect.js:282:3)
  at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\mongo_client.js:224:5
  at maybePromise (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\utils.js:665:3)
  at MongoClient.connect (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongodb\lib\mongo_client.js:220:10)
  at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\connection.js:820:12
  at new Promise ()
  at NativeConnection.Connection.openUri (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\connection.js:817:19)
  at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\index.js:345:10
  at C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5
  at new Promise ()
  at promiseOrCallback (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\helpers\promiseOrCallback.js:30:10)
  at Mongoose._promiseOrCallback (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\index.js:1135:10)
  at Mongoose.connect (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\index.js:344:20)
  at Object. (C:\Users\Dell\Documents\Extra\fruit\app.js:3:10)
  at Module._compile (internal/modules/cjs/loader.js:1076:30)
  (Use <code>node --trace-warnings ...</code> to show where the warning was created)
  (node:18676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not
  handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag <code>--unhandled-rejections=strict</code> (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
  (node:18676) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.<br />
  (node:18676) UnhandledPromiseRejectionWarning: MongooseError: Operation <code>fruits.insertOne()</code> buffering timed out after 10000ms
  at Timeout. (C:\Users\Dell\Documents\Extra\fruit\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:184:20)
  at listOnTimeout (internal/timers.js:554:17)
  at processTimers (internal/timers.js:497:7)
  (node:18676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not
  handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag <code>--unhandled-rejections=strict</code> (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)</p>
  <p>The Code is given below:</p>
  <pre><code>const mongoose=require('mongoose');
  
  mongoose.connect('monogodb://localhost:27017/fruitsDB',{ useNewUrlParser:true,family:4});
  
  const fruitSchema=new mongoose.Schema({
  name:String,
  rating:Number,
  review:String
  });
  
  const Fruit=mongoose.model(&quot;Fruit&quot;,fruitSchema);
  
  const fruit=new Fruit({
  name:&quot;Apple&quot;,
  rating:7,
  review:&quot;Pretty Good!&quot;
  });
  
  fruit.save();
  </code></pre>