lib/operations/collection_ops.js
function prepareDocs(coll, docs, options) {
  const forceServerObjectId =
    typeof options.forceServerObjectId === 'boolean'
      ? options.forceServerObjectId
      : coll.s.db.options.forceServerObjectId;

  // no need to modify the docs if server sets the ObjectId
  if (forceServerObjectId === true) {
    return docs;
  }

  return docs.map(doc => {
    if (forceServerObjectId !== true && doc._id == null) {
      doc._id = coll.s.pkFactory.createPk();
    }

    return doc;
  });
}
function prepareDocs(coll, docs, options) {
  const forceServerObjectId =
    typeof options.forceServerObjectId === 'boolean'
      ? options.forceServerObjectId
      : coll.s.db.options.forceServerObjectId;

  // no need to modify the docs if server sets the ObjectId
  if (forceServerObjectId === true) {
    return docs;
  }

  return docs.map(doc => {
    if (forceServerObjectId !== true && doc._id == null) {
      doc._id = coll.s.pkFactory.createPk();
    }

    return doc;
  });
}
function prepareDocs ( coll , docs , options ) { const forceServerObjectId = typeof options . forceServerObjectId === 'boolean' ? options . forceServerObjectId : coll . s . db . options . forceServerObjectId ; // no need to modify the docs if server sets the ObjectId if ( forceServerObjectId === true ) { return docs ; } return docs . map ( doc => { if ( forceServerObjectId !== true && doc . _id == null ) { doc . _id = coll . s . pkFactory . createPk ( ) ; } return doc ; } ) ; }
modifies documents before being inserted or updated
modifies documents before being inserted or updated