@@ -52,6 +52,7 @@ import {isOptionalEqual, isPlainObject} from '../util';
5252import {
5353 AggregateFunction ,
5454 AliasedAggregate ,
55+ AliasedExpression ,
5556 Expression ,
5657 Field ,
5758 BooleanExpression ,
@@ -82,8 +83,6 @@ import {
8283 Union ,
8384 Unnest ,
8485 DeleteStage ,
85- UpsertStage ,
86- InsertStage ,
8786 InternalWhereStageOptions ,
8887 InternalOffsetStageOptions ,
8988 InternalLimitStageOptions ,
@@ -1503,53 +1502,8 @@ export class Pipeline implements firestore.Pipelines.Pipeline {
15031502 *
15041503 * @return A new {@code Pipeline} object with this stage appended to the stage list.
15051504 */
1506- delete ( ) : Pipeline ;
1507- /**
1508- * @beta
1509- * Performs a delete operation on documents from previous stages.
1510- *
1511- * TODO(dlarocque): Verify we want this function.
1512- *
1513- * @param collectionNameOrRef - The collection to delete from.
1514- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1515- */
1516- delete ( collectionNameOrRef : string | firestore . CollectionReference ) : Pipeline ;
1517- /**
1518- * @beta
1519- * Performs a delete operation on documents from previous stages.
1520- *
1521- * @example
1522- * ```typescript
1523- * // Deletes all documents in the books collection and returns their IDs.
1524- * firestore.pipeline().collection("books")
1525- * .delete({
1526- * returns: "DOCUMENT_ID",
1527- * });
1528- * ```
1529- *
1530- * @param options - The {@code DeleteStageOptions} to apply to the stage.
1531- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1532- */
1533- delete ( options : firestore . Pipelines . DeleteStageOptions ) : Pipeline ;
1534- delete (
1535- optionsOrCollection ?:
1536- | string
1537- | firestore . CollectionReference
1538- | firestore . Pipelines . DeleteStageOptions ,
1539- ) : Pipeline {
1540- let target = undefined ;
1541- if ( typeof optionsOrCollection === 'string' ) {
1542- target = this . db . collection ( optionsOrCollection ) ;
1543- } else if ( isCollectionReference ( optionsOrCollection ) ) {
1544- target = optionsOrCollection ;
1545- }
1546- const options = (
1547- ! isCollectionReference ( optionsOrCollection ) &&
1548- typeof optionsOrCollection !== 'string'
1549- ? optionsOrCollection
1550- : undefined
1551- ) as firestore . Pipelines . DeleteStageOptions | undefined ;
1552- return this . _addStage ( new DeleteStage ( target , options ) ) ;
1505+ delete ( ) : Pipeline {
1506+ return this . _addStage ( new DeleteStage ( ) ) ;
15531507 }
15541508
15551509 /**
@@ -1563,125 +1517,12 @@ export class Pipeline implements firestore.Pipelines.Pipeline {
15631517 * @beta
15641518 * Performs an update operation using documents from previous stages.
15651519 *
1566- * @param collectionNameOrRef - The collection to update.
1567- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1568- */
1569- update ( collectionNameOrRef : string | firestore . CollectionReference ) : Pipeline ;
1570- /**
1571- * @beta
1572- * Performs an update operation using documents from previous stages.
1573- *
1574- * @param options - The {@code UpdateStageOptions} to apply to the stage.
1575- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1576- */
1577- update ( options : firestore . Pipelines . UpdateStageOptions ) : Pipeline ;
1578- update (
1579- optionsOrCollection ?:
1580- | string
1581- | firestore . CollectionReference
1582- | firestore . Pipelines . UpdateStageOptions ,
1583- ) : Pipeline {
1584- let target = undefined ;
1585- if ( typeof optionsOrCollection === 'string' ) {
1586- target = this . db . collection ( optionsOrCollection ) ;
1587- } else if ( isCollectionReference ( optionsOrCollection ) ) {
1588- target = optionsOrCollection ;
1589- }
1590- const options = (
1591- ! isCollectionReference ( optionsOrCollection ) &&
1592- typeof optionsOrCollection !== 'string'
1593- ? optionsOrCollection
1594- : undefined
1595- ) as firestore . Pipelines . UpdateStageOptions | undefined ;
1596- return this . _addStage ( new UpdateStage ( target , options ) ) ;
1597- }
1598-
1599- /**
1600- * @beta
1601- * Performs an upsert operation using documents from previous stages.
1602- *
1603- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1604- */
1605- upsert ( ) : Pipeline ;
1606- /**
1607- * @beta
1608- * Performs an upsert operation using documents from previous stages.
1609- *
1610- * @param collectionNameOrRef - The collection to upsert to.
1520+ * @param transformedFields - The list of transformations to apply.
16111521 * @return A new {@code Pipeline} object with this stage appended to the stage list.
16121522 */
1613- upsert ( collectionNameOrRef : string | firestore . CollectionReference ) : Pipeline ;
1614- /**
1615- * @beta
1616- * Performs an upsert operation using documents from previous stages.
1617- *
1618- * @param options - The {@code UpsertStageOptions} to apply to the stage.
1619- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1620- */
1621- upsert ( options : firestore . Pipelines . UpsertStageOptions ) : Pipeline ;
1622- upsert (
1623- optionsOrCollection ?:
1624- | string
1625- | firestore . CollectionReference
1626- | firestore . Pipelines . UpsertStageOptions ,
1627- ) : Pipeline {
1628- let target = undefined ;
1629- if ( typeof optionsOrCollection === 'string' ) {
1630- target = this . db . collection ( optionsOrCollection ) ;
1631- } else if ( isCollectionReference ( optionsOrCollection ) ) {
1632- target = optionsOrCollection ;
1633- }
1634- const options = (
1635- ! isCollectionReference ( optionsOrCollection ) &&
1636- typeof optionsOrCollection !== 'string'
1637- ? optionsOrCollection
1638- : undefined
1639- ) as firestore . Pipelines . UpsertStageOptions | undefined ;
1640- return this . _addStage ( new UpsertStage ( target , options ) ) ;
1641- }
1642-
1643- /**
1644- * @beta
1645- * Performs an insert operation using documents from previous stages.
1646- *
1647- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1648- */
1649- insert ( ) : Pipeline ;
1650- /**
1651- * @beta
1652- * Performs an insert operation using documents from previous stages.
1653- *
1654- * @param collectionNameOrRef - The collection to insert to.
1655- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1656- */
1657- insert ( collectionNameOrRef : string | firestore . CollectionReference ) : Pipeline ;
1658- /**
1659- * @beta
1660- * Performs an insert operation using documents from previous stages.
1661- *
1662- * @param options - The {@code InsertStageOptions} to apply to the stage.
1663- * @return A new {@code Pipeline} object with this stage appended to the stage list.
1664- */
1665- insert ( options : firestore . Pipelines . InsertStageOptions ) : Pipeline ;
1666- insert (
1667- optionsOrCollection ?:
1668- | string
1669- | firestore . CollectionReference
1670- | firestore . Pipelines . InsertStageOptions ,
1671- ) : Pipeline {
1672- let target = undefined ;
1673- if ( typeof optionsOrCollection === 'string' ) {
1674- target = this . db . collection ( optionsOrCollection ) ;
1675- } else if ( isCollectionReference ( optionsOrCollection ) ) {
1676- target = optionsOrCollection ;
1677- }
1678- const options = (
1679- ! isCollectionReference ( optionsOrCollection ) &&
1680- typeof optionsOrCollection !== 'string'
1681- ? optionsOrCollection
1682- : undefined
1683- ) as firestore . Pipelines . InsertStageOptions | undefined ;
1684- return this . _addStage ( new InsertStage ( target , options ) ) ;
1523+ update ( transformedFields : AliasedExpression [ ] ) : Pipeline ;
1524+ update ( transformedFields ?: AliasedExpression [ ] ) : Pipeline {
1525+ return this . _addStage ( new UpdateStage ( transformedFields ) ) ;
16851526 }
16861527
16871528 /**
0 commit comments