node_modules/@google-cloud/firestore/build/src/write-batch.js
/**
     * Create a document with the provided object values. This will fail the batch
     * if a document exists at its location.
     *
     * @param {DocumentReference} documentRef A reference to the document to be
     * created.
     * @param {T} data The object to serialize as the document.
     * @returns {WriteBatch} This WriteBatch instance. Used for chaining
     * method calls.
     *
     * @example
     * let writeBatch = firestore.batch();
     * let documentRef = firestore.collection('col').doc();
     *
     * writeBatch.create(documentRef, {foo: 'bar'});
     *
     * writeBatch.commit().then(() => {
     *   console.log('Successfully executed batch.');
     * });
     */
Create a document with the provided object values. This will fail the batch
if a document exists at its location.

@param {DocumentReference} documentRef A reference to the document to be
created.
@param {T} data The object to serialize as the document.






Create a document with the provided object values . This will fail the batch if a document exists at its location . @param { DocumentReference } documentRef A reference to the document to be created . @param { T } data The object to serialize as the document .
create(documentRef, data) {
        reference_1.validateDocumentReference('documentRef', documentRef);
        const firestoreData = documentRef._converter.toFirestore(data);
        validateDocumentData('data', firestoreData, 
         false, this._allowUndefined);
        this.verifyNotCommitted();
        const transform = document_1.DocumentTransform.fromObject(documentRef, firestoreData);
        transform.validate();
        const precondition = new document_1.Precondition({ exists: false });
        const op = () => {
            const document = document_1.DocumentSnapshot.fromObject(documentRef, firestoreData);
            const write = document.toProto();
            if (!transform.isEmpty) {
                write.updateTransforms = transform.toProto(this._serializer);
            }
            return {
                write,
                precondition: precondition.toProto(),
            };
        };
        this._ops.push(op);
        return this;
    }
create ( documentRef , data ) { reference_1 . validateDocumentReference ( 'documentRef' , documentRef ) ; const firestoreData = documentRef . _converter . toFirestore ( data ) ; validateDocumentData ( 'data' , firestoreData , false , this . _allowUndefined ) ; this . verifyNotCommitted ( ) ; const transform = document_1 . DocumentTransform . fromObject ( documentRef , firestoreData ) ; transform . validate ( ) ; const precondition = new document_1 . Precondition ( { exists : false } ) ; const op = ( ) => { const document = document_1 . DocumentSnapshot . fromObject ( documentRef , firestoreData ) ; const write = document . toProto ( ) ; if ( ! transform . isEmpty ) { write . updateTransforms = transform . toProto ( this . _serializer ) ; } return { write , precondition : precondition . toProto ( ) , } ; } ; this . _ops . push ( op ) ; return this ; }
Create a document with the provided object values.
Create a document with the provided object values .
/* allowDeletes= */