title: How to create a document if it doesn't exist MongoDB Javascript?
body: <p>How do I create a document if it doesn't exist with MongoDB?</p>
  
  <pre><code>if(db.collection.find({_id: _id}) == null) {
    db.collection.insertOne({_id: _id});
  }
  </code></pre>
  
  <p>Thats the logic of what i'm thinking.</p>