title: NodeJS MongoDB question save() function creating empty documents in collection
body: <p>New to MongoDB and know some basic Node. Following an online tutorial for Node, Express and MongoDB. I have some code that is connecting to a remote cluster and pushing in a document into a collection. The connection works, but the document inserted is empty, as in, it contains just the autogenerated id. Here's the code:</p>
  <pre><code>const DB = process.env.DATABASE.replace(
    '&lt;PASSWORD&gt;',
    process.env.DATABASE_PASSWORD
  );
  mongoose
    .connect(DB, {
      useNewUrlParser: true,
      useCreateIndex: true,
      useFindAndModify: false,
    })
    .then(() =&gt; console.log('DB Connection successful'));
   
  const tourSchema = new mongoose.Schema();
  ({
    name: {
      type: String,
      required: [true, 'A tour must have a name'],
      unique: true,
    },
    rating: {
      type: Number,
      default: 4.5,
    },
    price: {
      type: Number,
      required: [true, 'A tour must have a price'],
    },
  });
   
  const Tour = mongoose.model('Tour', tourSchema);
   
  const testTour = new Tour({
    name: 'aaaa',
    rating: 3.0,
    price: 397,
  });
   
  testTour
    .save()
    .then((doc) =&gt; {
      console.log(doc);
    })
    .catch((err) =&gt; console.log('ERROR:', err));
  </code></pre>
  <p>Here is the output:</p>
  <p><a href="https://i.stack.imgur.com/NreB9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NreB9.png" alt="Console output showing an empty doc created" /></a></p>
  <p>If I look in Compass, I can see the empty document created, so the connection works. Could there be some different querystring params for the actual connection string? Here are the current querystring params for the MongoDB connection string (these were default): <code>retryWrites=true&amp;w=majority</code></p>
  <p>Any idea what I may be missing in the code?</p>
  <p>Thanks!</p>