code: void insertOne(final MongoNamespace namespace, final BsonDocument document) {
      this.waitUntilInitialized();
  
      try {
        ongoingOperationsGroup.enter();
        // Remove forbidden fields from the document before inserting it into the local collection.
        final BsonDocument docForStorage = sanitizeDocument(document);
  
        final NamespaceSynchronizationConfig nsConfig =
            this.syncConfig.getNamespaceConfig(namespace);
        final Lock lock = nsConfig.getLock().writeLock();
        lock.lock();
        final ChangeEvent<BsonDocument> event;
        final BsonValue documentId;
        try {
          getLocalCollection(namespace).insertOne(docForStorage);
          documentId = BsonUtils.getDocumentId(docForStorage);
          event = ChangeEvents.changeEventForLocalInsert(namespace, docForStorage, true);
          final CoreDocumentSynchronizationConfig config = syncConfig.addAndGetSynchronizedDocument(
              namespace,
              documentId
          );
          config.setSomePendingWritesAndSave(logicalT, event);
        } finally {
          lock.unlock();
        }
        checkAndInsertNamespaceListener(namespace);
        eventDispatcher.emitEvent(nsConfig, event);
      } finally {
        ongoingOperationsGroup.exit();
      }
    }
docs: Inserts a single document locally and being to synchronize it based on its _id. Inserting
  a document with the same _id twice will result in a duplicate key exception.
  
  @param namespace the namespace to put the document in.
  @param document  the document to insert.