lib/operations/collection_ops.js
function insertOne(coll, doc, options, callback) {
  if (Array.isArray(doc)) {
    return callback(
      MongoError.create({ message: 'doc parameter must be an object', driver: true })
    );
  }

  insertDocuments(coll, [doc], options, (err, r) => {
    if (callback == null) return;
    if (err && callback) return callback(err);
    // Workaround for pre 2.6 servers
    if (r == null) return callback(null, { result: { ok: 1 } });
    // Add values to top level to ensure crud spec compatibility
    r.insertedCount = r.result.n;
    r.insertedId = doc._id;
    if (callback) callback(null, r);
  });
}
function insertOne(coll, doc, options, callback) {
  if (Array.isArray(doc)) {
    return callback(
      MongoError.create({ message: 'doc parameter must be an object', driver: true })
    );
  }

  insertDocuments(coll, [doc], options, (err, r) => {
    if (callback == null) return;
    if (err && callback) return callback(err);
    // Workaround for pre 2.6 servers
    if (r == null) return callback(null, { result: { ok: 1 } });
    // Add values to top level to ensure crud spec compatibility
    r.insertedCount = r.result.n;
    r.insertedId = doc._id;
    if (callback) callback(null, r);
  });
}
function insertOne ( coll , doc , options , callback ) { if ( Array . isArray ( doc ) ) { return callback ( MongoError . create ( { message : 'doc parameter must be an object' , driver : true } ) ) ; } insertDocuments ( coll , [ doc ] , options , ( err , r ) => { if ( callback == null ) return ; if ( err && callback ) return callback ( err ) ; // Workaround for pre 2.6 servers if ( r == null ) return callback ( null , { result : { ok : 1 } } ) ; // Add values to top level to ensure crud spec compatibility r . insertedCount = r . result . n ; r . insertedId = doc . _id ; if ( callback ) callback ( null , r ) ; } ) ; }
Insert a single document into the collection. See Collection.prototype.insertOne for more information.

@method
@param {Collection} a Collection instance.
@param {object} doc Document to insert.
@param {object} [options] Optional settings. See Collection.prototype.insertOne for a list of options.
@param {Collection~insertOneWriteOpCallback} [callback] The command result callback
Insert a single document into the collection . See Collection . prototype . insertOne for more information .