diff --git a/docs-devsite/_toc.yaml b/docs-devsite/_toc.yaml deleted file mode 100644 index 401bcb3bc1..0000000000 --- a/docs-devsite/_toc.yaml +++ /dev/null @@ -1,828 +0,0 @@ -toc: -- title: firebase - path: /docs/reference/js/index -- title: ai - path: /docs/reference/js/ai.md - section: - - title: AI - path: /docs/reference/js/ai.ai.md - - title: AIError - path: /docs/reference/js/ai.aierror.md - - title: AIModel - path: /docs/reference/js/ai.aimodel.md - - title: AIOptions - path: /docs/reference/js/ai.aioptions.md - - title: AnyOfSchema - path: /docs/reference/js/ai.anyofschema.md - - title: ArraySchema - path: /docs/reference/js/ai.arrayschema.md - - title: AudioConversationController - path: /docs/reference/js/ai.audioconversationcontroller.md - - title: AudioTranscriptionConfig - path: /docs/reference/js/ai.audiotranscriptionconfig.md - - title: Backend - path: /docs/reference/js/ai.backend.md - - title: BaseParams - path: /docs/reference/js/ai.baseparams.md - - title: BooleanSchema - path: /docs/reference/js/ai.booleanschema.md - - title: ChatSession - path: /docs/reference/js/ai.chatsession.md - - title: ChromeAdapter - path: /docs/reference/js/ai.chromeadapter.md - - title: Citation - path: /docs/reference/js/ai.citation.md - - title: CitationMetadata - path: /docs/reference/js/ai.citationmetadata.md - - title: CodeExecutionResult - path: /docs/reference/js/ai.codeexecutionresult.md - - title: CodeExecutionResultPart - path: /docs/reference/js/ai.codeexecutionresultpart.md - - title: CodeExecutionTool - path: /docs/reference/js/ai.codeexecutiontool.md - - title: Content - path: /docs/reference/js/ai.content.md - - title: CountTokensRequest - path: /docs/reference/js/ai.counttokensrequest.md - - title: CountTokensResponse - path: /docs/reference/js/ai.counttokensresponse.md - - title: CustomErrorData - path: /docs/reference/js/ai.customerrordata.md - - title: Date_2 - path: /docs/reference/js/ai.date_2.md - - title: EnhancedGenerateContentResponse - path: /docs/reference/js/ai.enhancedgeneratecontentresponse.md - - title: ErrorDetails - path: /docs/reference/js/ai.errordetails.md - - title: ExecutableCode - path: /docs/reference/js/ai.executablecode.md - - title: ExecutableCodePart - path: /docs/reference/js/ai.executablecodepart.md - - title: FileData - path: /docs/reference/js/ai.filedata.md - - title: FileDataPart - path: /docs/reference/js/ai.filedatapart.md - - title: FunctionCall - path: /docs/reference/js/ai.functioncall.md - - title: FunctionCallingConfig - path: /docs/reference/js/ai.functioncallingconfig.md - - title: FunctionCallPart - path: /docs/reference/js/ai.functioncallpart.md - - title: FunctionDeclaration - path: /docs/reference/js/ai.functiondeclaration.md - - title: FunctionDeclarationsTool - path: /docs/reference/js/ai.functiondeclarationstool.md - - title: FunctionResponse - path: /docs/reference/js/ai.functionresponse.md - - title: FunctionResponsePart - path: /docs/reference/js/ai.functionresponsepart.md - - title: GenerateContentCandidate - path: /docs/reference/js/ai.generatecontentcandidate.md - - title: GenerateContentRequest - path: /docs/reference/js/ai.generatecontentrequest.md - - title: GenerateContentResponse - path: /docs/reference/js/ai.generatecontentresponse.md - - title: GenerateContentResult - path: /docs/reference/js/ai.generatecontentresult.md - - title: GenerateContentStreamResult - path: /docs/reference/js/ai.generatecontentstreamresult.md - - title: GenerationConfig - path: /docs/reference/js/ai.generationconfig.md - - title: GenerativeContentBlob - path: /docs/reference/js/ai.generativecontentblob.md - - title: GenerativeModel - path: /docs/reference/js/ai.generativemodel.md - - title: GoogleAIBackend - path: /docs/reference/js/ai.googleaibackend.md - - title: GoogleSearch - path: /docs/reference/js/ai.googlesearch.md - - title: GoogleSearchTool - path: /docs/reference/js/ai.googlesearchtool.md - - title: GroundingChunk - path: /docs/reference/js/ai.groundingchunk.md - - title: GroundingMetadata - path: /docs/reference/js/ai.groundingmetadata.md - - title: GroundingSupport - path: /docs/reference/js/ai.groundingsupport.md - - title: HybridParams - path: /docs/reference/js/ai.hybridparams.md - - title: ImagenGCSImage - path: /docs/reference/js/ai.imagengcsimage.md - - title: ImagenGenerationConfig - path: /docs/reference/js/ai.imagengenerationconfig.md - - title: ImagenGenerationResponse - path: /docs/reference/js/ai.imagengenerationresponse.md - - title: ImagenImageFormat - path: /docs/reference/js/ai.imagenimageformat.md - - title: ImagenInlineImage - path: /docs/reference/js/ai.imageninlineimage.md - - title: ImagenModel - path: /docs/reference/js/ai.imagenmodel.md - - title: ImagenModelParams - path: /docs/reference/js/ai.imagenmodelparams.md - - title: ImagenSafetySettings - path: /docs/reference/js/ai.imagensafetysettings.md - - title: InlineDataPart - path: /docs/reference/js/ai.inlinedatapart.md - - title: IntegerSchema - path: /docs/reference/js/ai.integerschema.md - - title: LanguageModelCreateCoreOptions - path: /docs/reference/js/ai.languagemodelcreatecoreoptions.md - - title: LanguageModelCreateOptions - path: /docs/reference/js/ai.languagemodelcreateoptions.md - - title: LanguageModelExpected - path: /docs/reference/js/ai.languagemodelexpected.md - - title: LanguageModelMessage - path: /docs/reference/js/ai.languagemodelmessage.md - - title: LanguageModelMessageContent - path: /docs/reference/js/ai.languagemodelmessagecontent.md - - title: LanguageModelPromptOptions - path: /docs/reference/js/ai.languagemodelpromptoptions.md - - title: LiveGenerationConfig - path: /docs/reference/js/ai.livegenerationconfig.md - - title: LiveGenerativeModel - path: /docs/reference/js/ai.livegenerativemodel.md - - title: LiveModelParams - path: /docs/reference/js/ai.livemodelparams.md - - title: LiveServerContent - path: /docs/reference/js/ai.liveservercontent.md - - title: LiveServerToolCall - path: /docs/reference/js/ai.liveservertoolcall.md - - title: LiveServerToolCallCancellation - path: /docs/reference/js/ai.liveservertoolcallcancellation.md - - title: LiveSession - path: /docs/reference/js/ai.livesession.md - - title: ModalityTokenCount - path: /docs/reference/js/ai.modalitytokencount.md - - title: ModelParams - path: /docs/reference/js/ai.modelparams.md - - title: NumberSchema - path: /docs/reference/js/ai.numberschema.md - - title: ObjectSchema - path: /docs/reference/js/ai.objectschema.md - - title: ObjectSchemaRequest - path: /docs/reference/js/ai.objectschemarequest.md - - title: OnDeviceParams - path: /docs/reference/js/ai.ondeviceparams.md - - title: PrebuiltVoiceConfig - path: /docs/reference/js/ai.prebuiltvoiceconfig.md - - title: PromptFeedback - path: /docs/reference/js/ai.promptfeedback.md - - title: RequestOptions - path: /docs/reference/js/ai.requestoptions.md - - title: RetrievedContextAttribution - path: /docs/reference/js/ai.retrievedcontextattribution.md - - title: SafetyRating - path: /docs/reference/js/ai.safetyrating.md - - title: SafetySetting - path: /docs/reference/js/ai.safetysetting.md - - title: Schema - path: /docs/reference/js/ai.schema.md - - title: SchemaInterface - path: /docs/reference/js/ai.schemainterface.md - - title: SchemaParams - path: /docs/reference/js/ai.schemaparams.md - - title: SchemaRequest - path: /docs/reference/js/ai.schemarequest.md - - title: SchemaShared - path: /docs/reference/js/ai.schemashared.md - - title: SearchEntrypoint - path: /docs/reference/js/ai.searchentrypoint.md - - title: Segment - path: /docs/reference/js/ai.segment.md - - title: SpeechConfig - path: /docs/reference/js/ai.speechconfig.md - - title: StartAudioConversationOptions - path: /docs/reference/js/ai.startaudioconversationoptions.md - - title: StartChatParams - path: /docs/reference/js/ai.startchatparams.md - - title: StringSchema - path: /docs/reference/js/ai.stringschema.md - - title: TemplateGenerativeModel - path: /docs/reference/js/ai.templategenerativemodel.md - - title: TemplateImagenModel - path: /docs/reference/js/ai.templateimagenmodel.md - - title: TextPart - path: /docs/reference/js/ai.textpart.md - - title: ThinkingConfig - path: /docs/reference/js/ai.thinkingconfig.md - - title: ToolConfig - path: /docs/reference/js/ai.toolconfig.md - - title: Transcription - path: /docs/reference/js/ai.transcription.md - - title: URLContext - path: /docs/reference/js/ai.urlcontext.md - - title: URLContextMetadata - path: /docs/reference/js/ai.urlcontextmetadata.md - - title: URLContextTool - path: /docs/reference/js/ai.urlcontexttool.md - - title: URLMetadata - path: /docs/reference/js/ai.urlmetadata.md - - title: UsageMetadata - path: /docs/reference/js/ai.usagemetadata.md - - title: VertexAIBackend - path: /docs/reference/js/ai.vertexaibackend.md - - title: VideoMetadata - path: /docs/reference/js/ai.videometadata.md - - title: VoiceConfig - path: /docs/reference/js/ai.voiceconfig.md - - title: WebAttribution - path: /docs/reference/js/ai.webattribution.md - - title: WebGroundingChunk - path: /docs/reference/js/ai.webgroundingchunk.md -- title: analytics - path: /docs/reference/js/analytics.md - section: - - title: Analytics - path: /docs/reference/js/analytics.analytics.md - - title: AnalyticsCallOptions - path: /docs/reference/js/analytics.analyticscalloptions.md - - title: AnalyticsSettings - path: /docs/reference/js/analytics.analyticssettings.md - - title: ConsentSettings - path: /docs/reference/js/analytics.consentsettings.md - - title: ControlParams - path: /docs/reference/js/analytics.controlparams.md - - title: CustomParams - path: /docs/reference/js/analytics.customparams.md - - title: EventParams - path: /docs/reference/js/analytics.eventparams.md - - title: GtagConfigParams - path: /docs/reference/js/analytics.gtagconfigparams.md - - title: Item - path: /docs/reference/js/analytics.item.md - - title: Promotion - path: /docs/reference/js/analytics.promotion.md - - title: SettingsOptions - path: /docs/reference/js/analytics.settingsoptions.md -- title: app - path: /docs/reference/js/app.md - section: - - title: FirebaseApp - path: /docs/reference/js/app.firebaseapp.md - - title: FirebaseAppSettings - path: /docs/reference/js/app.firebaseappsettings.md - - title: FirebaseOptions - path: /docs/reference/js/app.firebaseoptions.md - - title: FirebaseServerApp - path: /docs/reference/js/app.firebaseserverapp.md - - title: FirebaseServerAppSettings - path: /docs/reference/js/app.firebaseserverappsettings.md -- title: app-check - path: /docs/reference/js/app-check.md - section: - - title: AppCheck - path: /docs/reference/js/app-check.appcheck.md - - title: AppCheckOptions - path: /docs/reference/js/app-check.appcheckoptions.md - - title: AppCheckToken - path: /docs/reference/js/app-check.appchecktoken.md - - title: AppCheckTokenResult - path: /docs/reference/js/app-check.appchecktokenresult.md - - title: CustomProvider - path: /docs/reference/js/app-check.customprovider.md - - title: CustomProviderOptions - path: /docs/reference/js/app-check.customprovideroptions.md - - title: ReCaptchaEnterpriseProvider - path: /docs/reference/js/app-check.recaptchaenterpriseprovider.md - - title: ReCaptchaV3Provider - path: /docs/reference/js/app-check.recaptchav3provider.md -- title: auth - path: /docs/reference/js/auth.md - section: - - title: ActionCodeInfo - path: /docs/reference/js/auth.actioncodeinfo.md - - title: ActionCodeSettings - path: /docs/reference/js/auth.actioncodesettings.md - - title: ActionCodeURL - path: /docs/reference/js/auth.actioncodeurl.md - - title: AdditionalUserInfo - path: /docs/reference/js/auth.additionaluserinfo.md - - title: ApplicationVerifier - path: /docs/reference/js/auth.applicationverifier.md - - title: Auth - path: /docs/reference/js/auth.auth.md - - title: AuthCredential - path: /docs/reference/js/auth.authcredential.md - - title: AuthError - path: /docs/reference/js/auth.autherror.md - - title: AuthErrorMap - path: /docs/reference/js/auth.autherrormap.md - - title: AuthProvider - path: /docs/reference/js/auth.authprovider.md - - title: AuthSettings - path: /docs/reference/js/auth.authsettings.md - - title: Config - path: /docs/reference/js/auth.config.md - - title: ConfirmationResult - path: /docs/reference/js/auth.confirmationresult.md - - title: Dependencies - path: /docs/reference/js/auth.dependencies.md - - title: EmailAuthCredential - path: /docs/reference/js/auth.emailauthcredential.md - - title: EmailAuthProvider - path: /docs/reference/js/auth.emailauthprovider.md - - title: EmulatorConfig - path: /docs/reference/js/auth.emulatorconfig.md - - title: FacebookAuthProvider - path: /docs/reference/js/auth.facebookauthprovider.md - - title: GithubAuthProvider - path: /docs/reference/js/auth.githubauthprovider.md - - title: GoogleAuthProvider - path: /docs/reference/js/auth.googleauthprovider.md - - title: IdTokenResult - path: /docs/reference/js/auth.idtokenresult.md - - title: MultiFactorAssertion - path: /docs/reference/js/auth.multifactorassertion.md - - title: MultiFactorError - path: /docs/reference/js/auth.multifactorerror.md - - title: MultiFactorInfo - path: /docs/reference/js/auth.multifactorinfo.md - - title: MultiFactorResolver - path: /docs/reference/js/auth.multifactorresolver.md - - title: MultiFactorSession - path: /docs/reference/js/auth.multifactorsession.md - - title: MultiFactorUser - path: /docs/reference/js/auth.multifactoruser.md - - title: OAuthCredential - path: /docs/reference/js/auth.oauthcredential.md - - title: OAuthCredentialOptions - path: /docs/reference/js/auth.oauthcredentialoptions.md - - title: OAuthProvider - path: /docs/reference/js/auth.oauthprovider.md - - title: ParsedToken - path: /docs/reference/js/auth.parsedtoken.md - - title: PasswordPolicy - path: /docs/reference/js/auth.passwordpolicy.md - - title: PasswordValidationStatus - path: /docs/reference/js/auth.passwordvalidationstatus.md - - title: Persistence - path: /docs/reference/js/auth.persistence.md - - title: PhoneAuthCredential - path: /docs/reference/js/auth.phoneauthcredential.md - - title: PhoneAuthProvider - path: /docs/reference/js/auth.phoneauthprovider.md - - title: PhoneMultiFactorAssertion - path: /docs/reference/js/auth.phonemultifactorassertion.md - - title: PhoneMultiFactorEnrollInfoOptions - path: /docs/reference/js/auth.phonemultifactorenrollinfooptions.md - - title: PhoneMultiFactorGenerator - path: /docs/reference/js/auth.phonemultifactorgenerator.md - - title: PhoneMultiFactorInfo - path: /docs/reference/js/auth.phonemultifactorinfo.md - - title: PhoneMultiFactorSignInInfoOptions - path: /docs/reference/js/auth.phonemultifactorsignininfooptions.md - - title: PhoneSingleFactorInfoOptions - path: /docs/reference/js/auth.phonesinglefactorinfooptions.md - - title: PopupRedirectResolver - path: /docs/reference/js/auth.popupredirectresolver.md - - title: ReactNativeAsyncStorage - path: /docs/reference/js/auth.reactnativeasyncstorage.md - - title: RecaptchaParameters - path: /docs/reference/js/auth.recaptchaparameters.md - - title: RecaptchaVerifier - path: /docs/reference/js/auth.recaptchaverifier.md - - title: SAMLAuthProvider - path: /docs/reference/js/auth.samlauthprovider.md - - title: TotpMultiFactorAssertion - path: /docs/reference/js/auth.totpmultifactorassertion.md - - title: TotpMultiFactorGenerator - path: /docs/reference/js/auth.totpmultifactorgenerator.md - - title: TotpMultiFactorInfo - path: /docs/reference/js/auth.totpmultifactorinfo.md - - title: TotpSecret - path: /docs/reference/js/auth.totpsecret.md - - title: TwitterAuthProvider - path: /docs/reference/js/auth.twitterauthprovider.md - - title: User - path: /docs/reference/js/auth.user.md - - title: UserCredential - path: /docs/reference/js/auth.usercredential.md - - title: UserInfo - path: /docs/reference/js/auth.userinfo.md - - title: UserMetadata - path: /docs/reference/js/auth.usermetadata.md -- title: database - path: /docs/reference/js/database.md - section: - - title: Database - path: /docs/reference/js/database.database.md - - title: DatabaseReference - path: /docs/reference/js/database.databasereference.md - - title: DataSnapshot - path: /docs/reference/js/database.datasnapshot.md - - title: IteratedDataSnapshot - path: /docs/reference/js/database.iterateddatasnapshot.md - - title: ListenOptions - path: /docs/reference/js/database.listenoptions.md - - title: OnDisconnect - path: /docs/reference/js/database.ondisconnect.md - - title: Query - path: /docs/reference/js/database.query.md - - title: QueryConstraint - path: /docs/reference/js/database.queryconstraint.md - - title: ThenableReference - path: /docs/reference/js/database.thenablereference.md - - title: TransactionOptions - path: /docs/reference/js/database.transactionoptions.md - - title: TransactionResult - path: /docs/reference/js/database.transactionresult.md -- title: firestore - path: /docs/reference/js/firestore_.md - section: - - title: AggregateField - path: /docs/reference/js/firestore_.aggregatefield.md - - title: AggregateQuerySnapshot - path: /docs/reference/js/firestore_.aggregatequerysnapshot.md - - title: AggregateSpec - path: /docs/reference/js/firestore_.aggregatespec.md - - title: Bytes - path: /docs/reference/js/firestore_.bytes.md - - title: CollectionReference - path: /docs/reference/js/firestore_.collectionreference.md - - title: DocumentChange - path: /docs/reference/js/firestore_.documentchange.md - - title: DocumentData - path: /docs/reference/js/firestore_.documentdata.md - - title: DocumentReference - path: /docs/reference/js/firestore_.documentreference.md - - title: DocumentSnapshot - path: /docs/reference/js/firestore_.documentsnapshot.md - - title: ExperimentalLongPollingOptions - path: /docs/reference/js/firestore_.experimentallongpollingoptions.md - - title: FieldPath - path: /docs/reference/js/firestore_.fieldpath.md - - title: FieldValue - path: /docs/reference/js/firestore_.fieldvalue.md - - title: Firestore - path: /docs/reference/js/firestore_.firestore.md - - title: FirestoreDataConverter - path: /docs/reference/js/firestore_.firestoredataconverter.md - - title: FirestoreError - path: /docs/reference/js/firestore_.firestoreerror.md - - title: FirestoreSettings - path: /docs/reference/js/firestore_.firestoresettings.md - - title: GeoPoint - path: /docs/reference/js/firestore_.geopoint.md - - title: Index - path: /docs/reference/js/firestore_.index.md - - title: IndexConfiguration - path: /docs/reference/js/firestore_.indexconfiguration.md - - title: IndexField - path: /docs/reference/js/firestore_.indexfield.md - - title: LoadBundleTask - path: /docs/reference/js/firestore_.loadbundletask.md - - title: LoadBundleTaskProgress - path: /docs/reference/js/firestore_.loadbundletaskprogress.md - - title: MemoryCacheSettings - path: /docs/reference/js/firestore_.memorycachesettings.md - - title: MemoryEagerGarbageCollector - path: /docs/reference/js/firestore_.memoryeagergarbagecollector.md - - title: MemoryLocalCache - path: /docs/reference/js/firestore_.memorylocalcache.md - - title: MemoryLruGarbageCollector - path: /docs/reference/js/firestore_.memorylrugarbagecollector.md - - title: PersistenceSettings - path: /docs/reference/js/firestore_.persistencesettings.md - - title: PersistentCacheIndexManager - path: /docs/reference/js/firestore_.persistentcacheindexmanager.md - - title: PersistentCacheSettings - path: /docs/reference/js/firestore_.persistentcachesettings.md - - title: PersistentLocalCache - path: /docs/reference/js/firestore_.persistentlocalcache.md - - title: PersistentMultipleTabManager - path: /docs/reference/js/firestore_.persistentmultipletabmanager.md - - title: PersistentSingleTabManager - path: /docs/reference/js/firestore_.persistentsingletabmanager.md - - title: PersistentSingleTabManagerSettings - path: /docs/reference/js/firestore_.persistentsingletabmanagersettings.md - - title: Query - path: /docs/reference/js/firestore_.query.md - - title: QueryCompositeFilterConstraint - path: /docs/reference/js/firestore_.querycompositefilterconstraint.md - - title: QueryConstraint - path: /docs/reference/js/firestore_.queryconstraint.md - - title: QueryDocumentSnapshot - path: /docs/reference/js/firestore_.querydocumentsnapshot.md - - title: QueryEndAtConstraint - path: /docs/reference/js/firestore_.queryendatconstraint.md - - title: QueryFieldFilterConstraint - path: /docs/reference/js/firestore_.queryfieldfilterconstraint.md - - title: QueryLimitConstraint - path: /docs/reference/js/firestore_.querylimitconstraint.md - - title: QueryOrderByConstraint - path: /docs/reference/js/firestore_.queryorderbyconstraint.md - - title: QuerySnapshot - path: /docs/reference/js/firestore_.querysnapshot.md - - title: QueryStartAtConstraint - path: /docs/reference/js/firestore_.querystartatconstraint.md - - title: SnapshotListenOptions - path: /docs/reference/js/firestore_.snapshotlistenoptions.md - - title: SnapshotMetadata - path: /docs/reference/js/firestore_.snapshotmetadata.md - - title: SnapshotOptions - path: /docs/reference/js/firestore_.snapshotoptions.md - - title: Timestamp - path: /docs/reference/js/firestore_.timestamp.md - - title: Transaction - path: /docs/reference/js/firestore_.transaction.md - - title: TransactionOptions - path: /docs/reference/js/firestore_.transactionoptions.md - - title: Unsubscribe - path: /docs/reference/js/firestore_.unsubscribe.md - - title: VectorValue - path: /docs/reference/js/firestore_.vectorvalue.md - - title: WriteBatch - path: /docs/reference/js/firestore_.writebatch.md -- title: firestore/lite - path: /docs/reference/js/firestore_lite.md - section: - - title: AggregateField - path: /docs/reference/js/firestore_lite.aggregatefield.md - - title: AggregateQuerySnapshot - path: /docs/reference/js/firestore_lite.aggregatequerysnapshot.md - - title: AggregateSpec - path: /docs/reference/js/firestore_lite.aggregatespec.md - - title: Bytes - path: /docs/reference/js/firestore_lite.bytes.md - - title: CollectionReference - path: /docs/reference/js/firestore_lite.collectionreference.md - - title: DocumentData - path: /docs/reference/js/firestore_lite.documentdata.md - - title: DocumentReference - path: /docs/reference/js/firestore_lite.documentreference.md - - title: DocumentSnapshot - path: /docs/reference/js/firestore_lite.documentsnapshot.md - - title: FieldPath - path: /docs/reference/js/firestore_lite.fieldpath.md - - title: FieldValue - path: /docs/reference/js/firestore_lite.fieldvalue.md - - title: Firestore - path: /docs/reference/js/firestore_lite.firestore.md - - title: FirestoreDataConverter - path: /docs/reference/js/firestore_lite.firestoredataconverter.md - - title: FirestoreError - path: /docs/reference/js/firestore_lite.firestoreerror.md - - title: GeoPoint - path: /docs/reference/js/firestore_lite.geopoint.md - - title: Query - path: /docs/reference/js/firestore_lite.query.md - - title: QueryCompositeFilterConstraint - path: /docs/reference/js/firestore_lite.querycompositefilterconstraint.md - - title: QueryConstraint - path: /docs/reference/js/firestore_lite.queryconstraint.md - - title: QueryDocumentSnapshot - path: /docs/reference/js/firestore_lite.querydocumentsnapshot.md - - title: QueryEndAtConstraint - path: /docs/reference/js/firestore_lite.queryendatconstraint.md - - title: QueryFieldFilterConstraint - path: /docs/reference/js/firestore_lite.queryfieldfilterconstraint.md - - title: QueryLimitConstraint - path: /docs/reference/js/firestore_lite.querylimitconstraint.md - - title: QueryOrderByConstraint - path: /docs/reference/js/firestore_lite.queryorderbyconstraint.md - - title: QuerySnapshot - path: /docs/reference/js/firestore_lite.querysnapshot.md - - title: QueryStartAtConstraint - path: /docs/reference/js/firestore_lite.querystartatconstraint.md - - title: Settings - path: /docs/reference/js/firestore_lite.settings.md - - title: Timestamp - path: /docs/reference/js/firestore_lite.timestamp.md - - title: Transaction - path: /docs/reference/js/firestore_lite.transaction.md - - title: TransactionOptions - path: /docs/reference/js/firestore_lite.transactionoptions.md - - title: VectorValue - path: /docs/reference/js/firestore_lite.vectorvalue.md - - title: WriteBatch - path: /docs/reference/js/firestore_lite.writebatch.md -- title: firestore/lite/pipelines - path: /docs/reference/js/firestore_lite_pipelines.md - section: - - title: AggregateFunction - path: /docs/reference/js/firestore_lite_pipelines.aggregatefunction.md - - title: AliasedAggregate - path: /docs/reference/js/firestore_lite_pipelines.aliasedaggregate.md - - title: AliasedExpression - path: /docs/reference/js/firestore_lite_pipelines.aliasedexpression.md - - title: BooleanExpression - path: /docs/reference/js/firestore_lite_pipelines.booleanexpression.md - - title: Bytes - path: /docs/reference/js/firestore_lite_pipelines.bytes.md - - title: CollectionReference - path: /docs/reference/js/firestore_lite_pipelines.collectionreference.md - - title: DocumentData - path: /docs/reference/js/firestore_lite_pipelines.documentdata.md - - title: DocumentReference - path: /docs/reference/js/firestore_lite_pipelines.documentreference.md - - title: DocumentSnapshot - path: /docs/reference/js/firestore_lite_pipelines.documentsnapshot.md - - title: Expression - path: /docs/reference/js/firestore_lite_pipelines.expression.md - - title: Field - path: /docs/reference/js/firestore_lite_pipelines.field.md - - title: FieldPath - path: /docs/reference/js/firestore_lite_pipelines.fieldpath.md - - title: FieldValue - path: /docs/reference/js/firestore_lite_pipelines.fieldvalue.md - - title: Firestore - path: /docs/reference/js/firestore_lite_pipelines.firestore.md - - title: FirestoreDataConverter - path: /docs/reference/js/firestore_lite_pipelines.firestoredataconverter.md - - title: FunctionExpression - path: /docs/reference/js/firestore_lite_pipelines.functionexpression.md - - title: GeoPoint - path: /docs/reference/js/firestore_lite_pipelines.geopoint.md - - title: Ordering - path: /docs/reference/js/firestore_lite_pipelines.ordering.md - - title: Pipeline - path: /docs/reference/js/firestore_lite_pipelines.pipeline.md - - title: PipelineResult - path: /docs/reference/js/firestore_lite_pipelines.pipelineresult.md - - title: PipelineSnapshot - path: /docs/reference/js/firestore_lite_pipelines.pipelinesnapshot.md - - title: PipelineSource - path: /docs/reference/js/firestore_lite_pipelines.pipelinesource.md - - title: Query - path: /docs/reference/js/firestore_lite_pipelines.query.md - - title: QueryDocumentSnapshot - path: /docs/reference/js/firestore_lite_pipelines.querydocumentsnapshot.md - - title: Selectable - path: /docs/reference/js/firestore_lite_pipelines.selectable.md - - title: StageOptions - path: /docs/reference/js/firestore_lite_pipelines.stageoptions.md - - title: Timestamp - path: /docs/reference/js/firestore_lite_pipelines.timestamp.md - - title: VectorValue - path: /docs/reference/js/firestore_lite_pipelines.vectorvalue.md -- title: firestore/pipelines - path: /docs/reference/js/firestore_pipelines.md - section: - - title: AggregateFunction - path: /docs/reference/js/firestore_pipelines.aggregatefunction.md - - title: AliasedAggregate - path: /docs/reference/js/firestore_pipelines.aliasedaggregate.md - - title: AliasedExpression - path: /docs/reference/js/firestore_pipelines.aliasedexpression.md - - title: BooleanExpression - path: /docs/reference/js/firestore_pipelines.booleanexpression.md - - title: Bytes - path: /docs/reference/js/firestore_pipelines.bytes.md - - title: CollectionReference - path: /docs/reference/js/firestore_pipelines.collectionreference.md - - title: DocumentData - path: /docs/reference/js/firestore_pipelines.documentdata.md - - title: DocumentReference - path: /docs/reference/js/firestore_pipelines.documentreference.md - - title: DocumentSnapshot - path: /docs/reference/js/firestore_pipelines.documentsnapshot.md - - title: Expression - path: /docs/reference/js/firestore_pipelines.expression.md - - title: Field - path: /docs/reference/js/firestore_pipelines.field.md - - title: FieldPath - path: /docs/reference/js/firestore_pipelines.fieldpath.md - - title: FieldValue - path: /docs/reference/js/firestore_pipelines.fieldvalue.md - - title: Firestore - path: /docs/reference/js/firestore_pipelines.firestore.md - - title: FirestoreDataConverter - path: /docs/reference/js/firestore_pipelines.firestoredataconverter.md - - title: FunctionExpression - path: /docs/reference/js/firestore_pipelines.functionexpression.md - - title: GeoPoint - path: /docs/reference/js/firestore_pipelines.geopoint.md - - title: Ordering - path: /docs/reference/js/firestore_pipelines.ordering.md - - title: Pipeline - path: /docs/reference/js/firestore_pipelines.pipeline.md - - title: PipelineExecuteOptions - path: /docs/reference/js/firestore_pipelines.pipelineexecuteoptions.md - - title: PipelineResult - path: /docs/reference/js/firestore_pipelines.pipelineresult.md - - title: PipelineSnapshot - path: /docs/reference/js/firestore_pipelines.pipelinesnapshot.md - - title: PipelineSource - path: /docs/reference/js/firestore_pipelines.pipelinesource.md - - title: Query - path: /docs/reference/js/firestore_pipelines.query.md - - title: QueryDocumentSnapshot - path: /docs/reference/js/firestore_pipelines.querydocumentsnapshot.md - - title: Selectable - path: /docs/reference/js/firestore_pipelines.selectable.md - - title: SnapshotMetadata - path: /docs/reference/js/firestore_pipelines.snapshotmetadata.md - - title: SnapshotOptions - path: /docs/reference/js/firestore_pipelines.snapshotoptions.md - - title: StageOptions - path: /docs/reference/js/firestore_pipelines.stageoptions.md - - title: Timestamp - path: /docs/reference/js/firestore_pipelines.timestamp.md - - title: VectorValue - path: /docs/reference/js/firestore_pipelines.vectorvalue.md -- title: functions - path: /docs/reference/js/functions.md - section: - - title: Functions - path: /docs/reference/js/functions.functions.md - - title: FunctionsError - path: /docs/reference/js/functions.functionserror.md - - title: HttpsCallable - path: /docs/reference/js/functions.httpscallable.md - - title: HttpsCallableOptions - path: /docs/reference/js/functions.httpscallableoptions.md - - title: HttpsCallableResult - path: /docs/reference/js/functions.httpscallableresult.md - - title: HttpsCallableStreamOptions - path: /docs/reference/js/functions.httpscallablestreamoptions.md - - title: HttpsCallableStreamResult - path: /docs/reference/js/functions.httpscallablestreamresult.md -- title: installations - path: /docs/reference/js/installations.md - section: - - title: Installations - path: /docs/reference/js/installations.installations.md -- title: messaging - path: /docs/reference/js/messaging_.md - section: - - title: FcmOptions - path: /docs/reference/js/messaging_.fcmoptions.md - - title: GetTokenOptions - path: /docs/reference/js/messaging_.gettokenoptions.md - - title: MessagePayload - path: /docs/reference/js/messaging_.messagepayload.md - - title: Messaging - path: /docs/reference/js/messaging_.messaging.md - - title: NotificationPayload - path: /docs/reference/js/messaging_.notificationpayload.md -- title: messaging/sw - path: /docs/reference/js/messaging_sw.md - section: - - title: FcmOptions - path: /docs/reference/js/messaging_sw.fcmoptions.md - - title: GetTokenOptions - path: /docs/reference/js/messaging_sw.gettokenoptions.md - - title: MessagePayload - path: /docs/reference/js/messaging_sw.messagepayload.md - - title: Messaging - path: /docs/reference/js/messaging_sw.messaging.md - - title: NotificationPayload - path: /docs/reference/js/messaging_sw.notificationpayload.md -- title: performance - path: /docs/reference/js/performance.md - section: - - title: FirebasePerformance - path: /docs/reference/js/performance.firebaseperformance.md - - title: PerformanceSettings - path: /docs/reference/js/performance.performancesettings.md - - title: PerformanceTrace - path: /docs/reference/js/performance.performancetrace.md -- title: remote-config - path: /docs/reference/js/remote-config.md - section: - - title: ConfigUpdate - path: /docs/reference/js/remote-config.configupdate.md - - title: ConfigUpdateObserver - path: /docs/reference/js/remote-config.configupdateobserver.md - - title: CustomSignals - path: /docs/reference/js/remote-config.customsignals.md - - title: FetchResponse - path: /docs/reference/js/remote-config.fetchresponse.md - - title: FirebaseRemoteConfigObject - path: /docs/reference/js/remote-config.firebaseremoteconfigobject.md - - title: RemoteConfig - path: /docs/reference/js/remote-config.remoteconfig.md - - title: RemoteConfigOptions - path: /docs/reference/js/remote-config.remoteconfigoptions.md - - title: RemoteConfigSettings - path: /docs/reference/js/remote-config.remoteconfigsettings.md - - title: Value - path: /docs/reference/js/remote-config.value.md -- title: storage - path: /docs/reference/js/storage.md - section: - - title: FirebaseStorage - path: /docs/reference/js/storage.firebasestorage.md - - title: FullMetadata - path: /docs/reference/js/storage.fullmetadata.md - - title: ListOptions - path: /docs/reference/js/storage.listoptions.md - - title: ListResult - path: /docs/reference/js/storage.listresult.md - - title: SettableMetadata - path: /docs/reference/js/storage.settablemetadata.md - - title: StorageError - path: /docs/reference/js/storage.storageerror.md - - title: StorageObserver - path: /docs/reference/js/storage.storageobserver.md - - title: StorageReference - path: /docs/reference/js/storage.storagereference.md - - title: UploadMetadata - path: /docs/reference/js/storage.uploadmetadata.md - - title: UploadResult - path: /docs/reference/js/storage.uploadresult.md - - title: UploadTask - path: /docs/reference/js/storage.uploadtask.md - - title: UploadTaskSnapshot - path: /docs/reference/js/storage.uploadtasksnapshot.md diff --git a/docs-devsite/firestore_.md b/docs-devsite/firestore_.md index 5d237fcafe..3787d34b27 100644 --- a/docs-devsite/firestore_.md +++ b/docs-devsite/firestore_.md @@ -34,7 +34,7 @@ https://github.com/firebase/firebase-js-sdk | [enableIndexedDbPersistence(firestore, persistenceSettings)](./firestore_.md#enableindexeddbpersistence_224174f) | Attempts to enable persistent storage, if possible.On failure, enableIndexedDbPersistence() will reject the promise or throw an exception. There are several reasons why this can fail, which can be identified by the code on the error.\* failed-precondition: The app is already open in another browser tab. \* unimplemented: The browser is incompatible with the offline persistence implementation.Note that even after a failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled.Note: enableIndexedDbPersistence() must be called before any other functions (other than [initializeFirestore()](./firestore_.md#initializefirestore_fc7d200), [getFirestore()](./firestore_.md#getfirestore) or [clearIndexedDbPersistence()](./firestore_.md#clearindexeddbpersistence_231a8e0).Persistence cannot be used in a Node.js environment. | | [enableMultiTabIndexedDbPersistence(firestore)](./firestore_.md#enablemultitabindexeddbpersistence_231a8e0) | Attempts to enable multi-tab persistent storage, if possible. If enabled across all tabs, all operations share access to local persistence, including shared execution of queries and latency-compensated local document updates across all connected instances.On failure, enableMultiTabIndexedDbPersistence() will reject the promise or throw an exception. There are several reasons why this can fail, which can be identified by the code on the error.\* failed-precondition: The app is already open in another browser tab and multi-tab is not enabled. \* unimplemented: The browser is incompatible with the offline persistence implementation.Note that even after a failure, the [Firestore](./firestore_.firestore.md#firestore_class) instance will remain usable, however offline persistence will be disabled. | | [enableNetwork(firestore)](./firestore_.md#enablenetwork_231a8e0) | Re-enables use of the network for this [Firestore](./firestore_.firestore.md#firestore_class) instance after a prior call to [disableNetwork()](./firestore_.md#disablenetwork_231a8e0). | -| [getPersistentCacheIndexManager(firestore)](./firestore_.md#getpersistentcacheindexmanager_231a8e0) | Returns the PersistentCache Index Manager used by the given Firestore object. The PersistentCacheIndexManager instance, or null if local persistent storage is not in use. | +| [getPersistentCacheIndexManager(firestore)](./firestore_.md#getpersistentcacheindexmanager_231a8e0) | Returns the PersistentCache Index Manager used by the given Firestore object. | | [loadBundle(firestore, bundleData)](./firestore_.md#loadbundle_bec5b75) | Loads a Firestore bundle into the local cache. | | [namedQuery(firestore, name)](./firestore_.md#namedquery_6438876) | Reads a Firestore [Query](./firestore_.query.md#query_class) from local cache, identified by the given name.The named queries are packaged into bundles on the server side (along with resulting documents), and loaded to local cache using loadBundle. Once in local cache, use this method to extract a [Query](./firestore_.query.md#query_class) by name. | | [onSnapshotResume(firestore, snapshotJson, onNext, onError, onCompletion, converter)](./firestore_.md#onsnapshotresume_7c84f5e) | Attaches a listener for QuerySnapshot events based on data generated by invoking [QuerySnapshot.toJSON()](./firestore_.querysnapshot.md#querysnapshottojson) You may either pass individual onNext and onError callbacks or pass a single observer object with next and error callbacks. The listener can be cancelled by calling the function that is returned when onSnapshot is called.NOTE: Although an onCompletion callback can be provided, it will never be called because the snapshot stream is never-ending. | @@ -170,7 +170,7 @@ https://github.com/firebase/firebase-js-sdk | [SnapshotMetadata](./firestore_.snapshotmetadata.md#snapshotmetadata_class) | Metadata about a snapshot, describing the state of the snapshot. | | [Timestamp](./firestore_.timestamp.md#timestamp_class) | A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.For examples and further specifications, refer to the [Timestamp definition](https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto). | | [Transaction](./firestore_.transaction.md#transaction_class) | A reference to a transaction.The Transaction object passed to a transaction's updateFunction provides the methods to read and write data within the transaction context. See [runTransaction()](./firestore_.md#runtransaction_6f03ec4). | -| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). VectorValue | +| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). | | [WriteBatch](./firestore_.writebatch.md#writebatch_class) | A write batch, used to perform multiple writes as a single atomic unit.A WriteBatch object can be acquired by calling [writeBatch()](./firestore_.md#writebatch_231a8e0). It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until [WriteBatch.commit()](./firestore_.writebatch.md#writebatchcommit) is called. | ## Interfaces @@ -660,8 +660,6 @@ A `Promise` that is resolved once the network has been enabled. Returns the PersistentCache Index Manager used by the given `Firestore` object. - The `PersistentCacheIndexManager` instance, or `null` if local persistent storage is not in use. - Signature: ```typescript @@ -678,6 +676,8 @@ export declare function getPersistentCacheIndexManager(firestore: Firestore): Pe [PersistentCacheIndexManager](./firestore_.persistentcacheindexmanager.md#persistentcacheindexmanager_class) \| null +The `PersistentCacheIndexManager` instance, or `null` if local persistent storage is not in use. + ### loadBundle(firestore, bundleData) {:#loadbundle_bec5b75} Loads a Firestore bundle into the local cache. diff --git a/docs-devsite/firestore_.vectorvalue.md b/docs-devsite/firestore_.vectorvalue.md index 1fc4e2b35a..fe03c3a690 100644 --- a/docs-devsite/firestore_.vectorvalue.md +++ b/docs-devsite/firestore_.vectorvalue.md @@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk # VectorValue class Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). - VectorValue - Signature: ```typescript diff --git a/docs-devsite/firestore_lite.md b/docs-devsite/firestore_lite.md index 20fafd66c5..1a2ca88300 100644 --- a/docs-devsite/firestore_lite.md +++ b/docs-devsite/firestore_lite.md @@ -119,7 +119,7 @@ https://github.com/firebase/firebase-js-sdk | [QueryStartAtConstraint](./firestore_lite.querystartatconstraint.md#querystartatconstraint_class) | A QueryStartAtConstraint is used to exclude documents from the start of a result set returned by a Firestore query. QueryStartAtConstraints are created by invoking [startAt()](./firestore_.md#startat_9a4477f) or [startAfter()](./firestore_.md#startafter_9a4477f) and can then be passed to [query()](./firestore_.md#query_9f7b0f4) to create a new query instance that also contains this QueryStartAtConstraint. | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.For examples and further specifications, refer to the [Timestamp definition](https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto). | | [Transaction](./firestore_lite.transaction.md#transaction_class) | A reference to a transaction.The Transaction object passed to a transaction's updateFunction provides the methods to read and write data within the transaction context. See [runTransaction()](./firestore_.md#runtransaction_6f03ec4). | -| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). VectorValue | +| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). | | [WriteBatch](./firestore_lite.writebatch.md#writebatch_class) | A write batch, used to perform multiple writes as a single atomic unit.A WriteBatch object can be acquired by calling [writeBatch()](./firestore_.md#writebatch_231a8e0). It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until [WriteBatch.commit()](./firestore_.writebatch.md#writebatchcommit) is called. | ## Interfaces diff --git a/docs-devsite/firestore_lite.vectorvalue.md b/docs-devsite/firestore_lite.vectorvalue.md index 17c18e4c4e..4b675d4c94 100644 --- a/docs-devsite/firestore_lite.vectorvalue.md +++ b/docs-devsite/firestore_lite.vectorvalue.md @@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk # VectorValue class Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). - VectorValue - Signature: ```typescript diff --git a/docs-devsite/firestore_lite_pipelines.aggregatefunction.md b/docs-devsite/firestore_lite_pipelines.aggregatefunction.md index 17925a6144..fe3dfc3b93 100644 --- a/docs-devsite/firestore_lite_pipelines.aggregatefunction.md +++ b/docs-devsite/firestore_lite_pipelines.aggregatefunction.md @@ -37,14 +37,7 @@ export declare class AggregateFunction | Method | Modifiers | Description | | --- | --- | --- | -| [as(name)](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunctionas) | | (Public Preview) Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document. -```typescript -// Calculate the average price of all items and assign it the alias "averagePrice". -firestore.pipeline().collection("items") - .aggregate(field("price").average().as("averagePrice")); - -``` - | +| [as(name)](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunctionas) | | (Public Preview) Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document. | ## AggregateFunction.(constructor) @@ -84,13 +77,6 @@ exprType: ExpressionType; Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document. -```typescript -// Calculate the average price of all items and assign it the alias "averagePrice". -firestore.pipeline().collection("items") - .aggregate(field("price").average().as("averagePrice")); - -``` - Signature: ```typescript @@ -101,9 +87,21 @@ as(name: string): AliasedAggregate; | Parameter | Type | Description | | --- | --- | --- | -| name | string | The alias to assign to this AggregateFunction. A new that wraps this AggregateFunction and associates it with the provided alias. | +| name | string | The alias to assign to this AggregateFunction. | Returns: [AliasedAggregate](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregate_class) +A new [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) that wraps this AggregateFunction and associates it with the provided alias. + +### Example + + +```typescript +// Calculate the average price of all items and assign it the alias "averagePrice". +firestore.pipeline().collection("items") + .aggregate(field("price").average().as("averagePrice")); + +``` + diff --git a/docs-devsite/firestore_lite_pipelines.booleanexpression.md b/docs-devsite/firestore_lite_pipelines.booleanexpression.md index f77b0e503d..f970712c06 100644 --- a/docs-devsite/firestore_lite_pipelines.booleanexpression.md +++ b/docs-devsite/firestore_lite_pipelines.booleanexpression.md @@ -26,57 +26,13 @@ export declare abstract class BooleanExpression extends Expression | Method | Modifiers | Description | | --- | --- | --- | -| [conditional(thenExpr, elseExpr)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressionconditional) | | (Public Preview) Creates a conditional expression that evaluates to the 'then' expression if this expression evaluates to true, or evaluates to the 'else' expression if this expressions evaluates false. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor")); - -``` - | -| [countIf()](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioncountif) | | (Public Preview) Creates an aggregation that finds the count of input documents satisfying this boolean expression. -```typescript -// Find the count of documents with a score greater than 90 -field("score").greaterThan(90).countIf().as("highestScore"); - -``` - A new AggregateFunction representing the 'countIf' aggregation. | -| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(constant(false)); - -``` - | -| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(false); - -``` - | -| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(constant(0)); - -``` - | -| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(0); - -``` - | -| [not()](./firestore_lite_pipelines.booleanexpression.md#booleanexpressionnot) | | (Public Preview) Creates an expression that negates this boolean expression. -```typescript -// Find documents where the 'tags' field does not contain 'completed' -field("tags").arrayContains("completed").not(); - -``` - A new representing the negated filter condition. | +| [conditional(thenExpr, elseExpr)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressionconditional) | | (Public Preview) Creates a conditional expression that evaluates to the 'then' expression if this expression evaluates to true, or evaluates to the 'else' expression if this expressions evaluates false. | +| [countIf()](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioncountif) | | (Public Preview) Creates an aggregation that finds the count of input documents satisfying this boolean expression. | +| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_lite_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [not()](./firestore_lite_pipelines.booleanexpression.md#booleanexpressionnot) | | (Public Preview) Creates an expression that negates this boolean expression. | ## BooleanExpression.conditional() @@ -85,12 +41,6 @@ field("tags").arrayContains("completed").not(); Creates a conditional expression that evaluates to the 'then' expression if `this` expression evaluates to `true`, or evaluates to the 'else' expression if `this` expressions evaluates `false`. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor")); - -``` - Signature: ```typescript @@ -102,25 +52,29 @@ conditional(thenExpr: Expression, elseExpr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | thenExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is true. | -| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. A new representing the conditional expression. | +| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## BooleanExpression.countIf() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the conditional expression. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the count of input documents satisfying this boolean expression. ```typescript -// Find the count of documents with a score greater than 90 -field("score").greaterThan(90).countIf().as("highestScore"); +// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". +field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor")); ``` - A new `AggregateFunction` representing the 'countIf' aggregation. + +## BooleanExpression.countIf() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the count of input documents satisfying this boolean expression. Signature: @@ -131,20 +85,24 @@ countIf(): AggregateFunction; [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -## BooleanExpression.ifError() +A new `AggregateFunction` representing the 'countIf' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(constant(false)); +// Find the count of documents with a score greater than 90 +field("score").greaterThan(90).countIf().as("highestScore"); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -155,26 +113,31 @@ ifError(catchValue: BooleanExpression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The value that will be returned if this expression produces an error. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## BooleanExpression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript // Create an expression that protects against a divide by zero error // but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(false); +constant(50).divide('length').gt(1).ifError(constant(false)); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -185,25 +148,31 @@ ifError(catchValue: boolean): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | boolean | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | boolean | The value that will be returned if this expression produces an error. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## BooleanExpression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript -// Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(constant(0)); +// Create an expression that protects against a divide by zero error +// but always returns a boolean expression. +constant(50).divide('length').gt(1).ifError(false); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -214,25 +183,30 @@ ifError(catchValue: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The value that will be returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## BooleanExpression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript // Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(0); +constant(50).divide('length').gt(1).ifError(constant(0)); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -243,25 +217,29 @@ ifError(catchValue: unknown): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | unknown | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | unknown | The value that will be returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## BooleanExpression.not() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that negates this boolean expression. ```typescript -// Find documents where the 'tags' field does not contain 'completed' -field("tags").arrayContains("completed").not(); +// Create an expression that protects against a divide by zero error. +constant(50).divide('length').gt(1).ifError(0); ``` - A new representing the negated filter condition. + +## BooleanExpression.not() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that negates this boolean expression. Signature: @@ -272,3 +250,14 @@ not(): BooleanExpression; [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the negated filter condition. + +### Example + + +```typescript +// Find documents where the 'tags' field does not contain 'completed' +field("tags").arrayContains("completed").not(); + +``` + diff --git a/docs-devsite/firestore_lite_pipelines.expression.md b/docs-devsite/firestore_lite_pipelines.expression.md index fbaba7d825..b8790f8879 100644 --- a/docs-devsite/firestore_lite_pipelines.expression.md +++ b/docs-devsite/firestore_lite_pipelines.expression.md @@ -13,13 +13,13 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Represents an expression that can be evaluated to a value within the execution of a . +Represents an expression that can be evaluated to a value within the execution of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class). Expressions are the building blocks for creating complex queries and transformations in Firestore pipelines. They can represent: - \*\*Field references:\*\* Access values from document fields. - \*\*Literals:\*\* Represent constant values (strings, numbers, booleans). - \*\*Function calls:\*\* Apply functions to one or more expressions. -The `Expr` class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. +The `Expression` class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. Signature: @@ -37,821 +37,134 @@ export declare abstract class Expression | Method | Modifiers | Description | | --- | --- | --- | -| [abs()](./firestore_lite_pipelines.expression.md#expressionabs) | | (Public Preview) Creates an expression that computes the absolute value of a numeric value. -```typescript -// Compute the absolute value of the 'price' field. -field("price").abs(); - -``` - A new representing the absolute value of the numeric value. | -| [add(second)](./firestore_lite_pipelines.expression.md#expressionadd) | | (Public Preview) Creates an expression that adds this expression to another expression. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -field("quantity").add(field("reserve")); - -``` - | -| [arrayConcat(secondArray, otherArrays)](./firestore_lite_pipelines.expression.md#expressionarrayconcat) | | (Public Preview) Creates an expression that concatenates an array expression with one or more other arrays. -```typescript -// Combine the 'items' array with another array field. -field("items").arrayConcat(field("otherItems")); - -``` - | -| [arrayContains(expression)](./firestore_lite_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific element. -```typescript -// Check if the 'sizes' array contains the value from the 'selectedSize' field -field("sizes").arrayContains(field("selectedSize")); - -``` - | -| [arrayContains(value)](./firestore_lite_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific value. -```typescript -// Check if the 'colors' array contains "red" -field("colors").arrayContains("red"); - -``` - | -| [arrayContainsAll(values)](./firestore_lite_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. -```typescript -// Check if the 'tags' array contains both the value in field "tag1" and the literal value "tag2" -field("tags").arrayContainsAll([field("tag1"), "tag2"]); - -``` - | -| [arrayContainsAll(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. -```typescript -// Check if the 'tags' array contains both of the values from field "tag1" and the literal value "tag2" -field("tags").arrayContainsAll(array([field("tag1"), "tag2"])); - -``` - | -| [arrayContainsAny(values)](./firestore_lite_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. -```typescript -// Check if the 'categories' array contains either values from field "cate1" or "cate2" -field("categories").arrayContainsAny([field("cate1"), field("cate2")]); - -``` - | -| [arrayContainsAny(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. -```typescript -// Check if the 'groups' array contains either the value from the 'userGroup' field -// or the value "guest" -field("groups").arrayContainsAny(array([field("userGroup"), "guest"])); - -``` - | -| [arrayGet(offset)](./firestore_lite_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the 'tags' field array at index `1`. -field('tags').arrayGet(1); - -``` - | -| [arrayGet(offsetExpr)](./firestore_lite_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -field('tags').arrayGet(field('favoriteTag')); - -``` - | -| [arrayLength()](./firestore_lite_pipelines.expression.md#expressionarraylength) | | (Public Preview) Creates an expression that calculates the length of an array. -```typescript -// Get the number of items in the 'cart' array -field("cart").arrayLength(); - -``` - A new Expr representing the length of the array. | -| [arrayReverse()](./firestore_lite_pipelines.expression.md#expressionarrayreverse) | | (Public Preview) Creates an expression that reverses an array. -```typescript -// Reverse the value of the 'myArray' field. -field("myArray").arrayReverse(); - -``` - A new representing the reversed array. | -| [arraySum()](./firestore_lite_pipelines.expression.md#expressionarraysum) | | (Public Preview) Creates an expression that computes the sum of the elements in an array. -```typescript -// Compute the sum of the elements in the 'scores' field. -field("scores").arraySum(); - -``` - A new representing the sum of the elements in the array. | -| [as(name)](./firestore_lite_pipelines.expression.md#expressionas) | | (Public Preview) Assigns an alias to this expression.Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values. -```typescript -// Calculate the total price and assign it the alias "totalPrice" and add it to the output. -firestore.pipeline().collection("items") - .addFields(field("price").multiply(field("quantity")).as("totalPrice")); - -``` - | -| [asBoolean()](./firestore_lite_pipelines.expression.md#expressionasboolean) | | (Public Preview) Wraps the expression in a \[BooleanExpression\]. A \[BooleanExpression\] representing the same expression. | -| [ascending()](./firestore_lite_pipelines.expression.md#expressionascending) | | (Public Preview) Creates an that sorts documents in ascending order based on this expression. -```typescript -// Sort documents by the 'name' field in ascending order -pipeline().collection("users") - .sort(field("name").ascending()); - -``` - A new Ordering for ascending sorting. | -| [average()](./firestore_lite_pipelines.expression.md#expressionaverage) | | (Public Preview) Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. -```typescript -// Calculate the average age of users -field("age").average().as("averageAge"); - -``` - A new AggregateFunction representing the 'average' aggregation. | -| [byteLength()](./firestore_lite_pipelines.expression.md#expressionbytelength) | | (Public Preview) Creates an expression that calculates the length of this string expression in bytes. -```typescript -// Calculate the length of the 'myString' field in bytes. -field("myString").byteLength(); - -``` - A new representing the length of the string in bytes. | -| [ceil()](./firestore_lite_pipelines.expression.md#expressionceil) | | (Public Preview) Creates an expression that computes the ceiling of a numeric value. -```typescript -// Compute the ceiling of the 'price' field. -field("price").ceil(); - -``` - A new representing the ceiling of the numeric value. | -| [charLength()](./firestore_lite_pipelines.expression.md#expressioncharlength) | | (Public Preview) Creates an expression that calculates the character length of a string in UTF-8. -```typescript -// Get the character length of the 'name' field in its UTF-8 form. -field("name").charLength(); - -``` - A new Expr representing the length of the string. | -| [collectionId()](./firestore_lite_pipelines.expression.md#expressioncollectionid) | | (Public Preview) Creates an expression that returns the collection ID from a path. -```typescript -// Get the collection ID from a path. -field("__path__").collectionId(); - -``` - A new representing the collectionId operation. | -| [concat(second, others)](./firestore_lite_pipelines.expression.md#expressionconcat) | | (Public Preview) Creates an expression that concatenates expression results together. -```typescript -// Combine the 'firstName', ' ', and 'lastName' fields into a single value. -field("firstName").concat(constant(" "), field("lastName")); - -``` - | -| [cosineDistance(vectorExpression)](./firestore_lite_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the cosine distance between two vectors. -```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -field("userVector").cosineDistance(field("itemVector")); - -``` - | -| [cosineDistance(vector)](./firestore_lite_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the Cosine distance between two vectors. -```typescript -// Calculate the Cosine distance between the 'location' field and a target location -field("location").cosineDistance(new VectorValue([37.7749, -122.4194])); - -``` - | -| [count()](./firestore_lite_pipelines.expression.md#expressioncount) | | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. -```typescript -// Count the total number of products -field("productId").count().as("totalProducts"); - -``` - A new AggregateFunction representing the 'count' aggregation. | -| [countDistinct()](./firestore_lite_pipelines.expression.md#expressioncountdistinct) | | (Public Preview) Creates an aggregation that counts the number of distinct values of the expression or field. -```typescript -// Count the distinct number of products -field("productId").countDistinct().as("distinctProducts"); - -``` - A new AggregateFunction representing the 'count\_distinct' aggregation. | -| [descending()](./firestore_lite_pipelines.expression.md#expressiondescending) | | (Public Preview) Creates an that sorts documents in descending order based on this expression. -```typescript -// Sort documents by the 'createdAt' field in descending order -firestore.pipeline().collection("users") - .sort(field("createdAt").descending()); - -``` - A new Ordering for descending sorting. | -| [divide(divisor)](./firestore_lite_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by another expression. -```typescript -// Divide the 'total' field by the 'count' field -field("total").divide(field("count")); - -``` - | -| [divide(divisor)](./firestore_lite_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by a constant value. -```typescript -// Divide the 'value' field by 10 -field("value").divide(10); - -``` - | -| [documentId()](./firestore_lite_pipelines.expression.md#expressiondocumentid) | | (Public Preview) Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -field("__path__").documentId(); - -``` - A new representing the documentId operation. | -| [dotProduct(vectorExpression)](./firestore_lite_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. -```typescript -// Calculate the dot product between a feature vector and a target vector -field("features").dotProduct([0.5, 0.8, 0.2]); - -``` - | -| [dotProduct(vector)](./firestore_lite_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. -```typescript -// Calculate the dot product between a feature vector and a target vector -field("features").dotProduct(new VectorValue([0.5, 0.8, 0.2])); - -``` - | -| [endsWith(suffix)](./firestore_lite_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix. -```typescript -// Check if the 'filename' field ends with ".txt" -field("filename").endsWith(".txt"); - -``` - | -| [endsWith(suffix)](./firestore_lite_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix (represented as an expression). -```typescript -// Check if the 'url' field ends with the value of the 'extension' field -field("url").endsWith(field("extension")); - -``` - | -| [equal(expression)](./firestore_lite_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to another expression. -```typescript -// Check if the 'age' field is equal to 21 -field("age").equal(21); - -``` - | -| [equal(value)](./firestore_lite_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to a constant value. -```typescript -// Check if the 'city' field is equal to "London" -field("city").equal("London"); - -``` - | -| [equalAny(values)](./firestore_lite_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -field("category").equalAny("Electronics", field("primaryType")); - -``` - | -| [equalAny(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -field("category").equalAny(array(["Electronics", field("primaryType")])); - -``` - | -| [euclideanDistance(vectorExpression)](./firestore_lite_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location -field("location").euclideanDistance([37.7749, -122.4194]); - -``` - | -| [euclideanDistance(vector)](./firestore_lite_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location -field("location").euclideanDistance(new VectorValue([37.7749, -122.4194])); - -``` - | -| [exists()](./firestore_lite_pipelines.expression.md#expressionexists) | | (Public Preview) Creates an expression that checks if a field exists in the document. -```typescript -// Check if the document has a field named "phoneNumber" -field("phoneNumber").exists(); - -``` - A new Expr representing the 'exists' check. | -| [exp()](./firestore_lite_pipelines.expression.md#expressionexp) | | (Public Preview) Creates an expression that computes e to the power of this expression. -```typescript -// Compute e to the power of the 'value' field. -field("value").exp(); - -``` - A new representing the exp of the numeric value. | -| [floor()](./firestore_lite_pipelines.expression.md#expressionfloor) | | (Public Preview) Creates an expression that computes the floor of a numeric value. -```typescript -// Compute the floor of the 'price' field. -field("price").floor(); - -``` - A new representing the floor of the numeric value. | -| [greaterThan(expression)](./firestore_lite_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than another expression. -```typescript -// Check if the 'age' field is greater than the 'limit' field -field("age").greaterThan(field("limit")); - -``` - | -| [greaterThan(value)](./firestore_lite_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than a constant value. -```typescript -// Check if the 'price' field is greater than 100 -field("price").greaterThan(100); - -``` - | -| [greaterThanOrEqual(expression)](./firestore_lite_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to another expression. -```typescript -// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1 -field("quantity").greaterThanOrEqual(field('requirement').add(1)); - -``` - | -| [greaterThanOrEqual(value)](./firestore_lite_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to a constant value. -```typescript -// Check if the 'score' field is greater than or equal to 80 -field("score").greaterThanOrEqual(80); - -``` - | -| [ifAbsent(elseValue)](./firestore_lite_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of the this expression evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -field("optional_field").ifAbsent("default_value") - -``` - | -| [ifAbsent(elseExpression)](./firestore_lite_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of this expression evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or if that is -// absent, then returns the value of the field ` -field("optional_field").ifAbsent(field('default_field')) - -``` - | -| [ifError(catchExpr)](./firestore_lite_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the result of the catchExpr argument if there is an error, else return the result of this expression. -```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -field("title").arrayGet(0).ifError(field("title")); - -``` - | -| [ifError(catchValue)](./firestore_lite_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Returns the first item in the title field arrays, or returns -// "Default Title" -field("title").arrayGet(0).ifError("Default Title"); - -``` - | -| [isAbsent()](./firestore_lite_pipelines.expression.md#expressionisabsent) | | (Public Preview) Creates an expression that returns true if the result of this expression is absent. Otherwise, returns false even if the value is null. -```typescript -// Check if the field `value` is absent. -field("value").isAbsent(); - -``` - A new representing the 'isAbsent' check. | -| [isError()](./firestore_lite_pipelines.expression.md#expressioniserror) | | (Public Preview) Creates an expression that checks if a given expression produces an error. -```typescript -// Check if the result of a calculation is an error -field("title").arrayContains(1).isError(); - -``` - A new representing the 'isError' check. | -| [join(delimiterExpression)](./firestore_lite_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -field("tags").join(field("separator")) - -``` - | -| [join(delimiter)](./firestore_lite_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array field into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -field("tags").join(", ") - -``` - | -| [length()](./firestore_lite_pipelines.expression.md#expressionlength) | | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. -```typescript -// Get the length of the 'name' field. -field("name").length(); - -// Get the number of items in the 'cart' array. -field("cart").length(); - -``` - A new Expr representing the length of the string, array, map, vector, or bytes. | -| [lessThan(experession)](./firestore_lite_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than another expression. -```typescript -// Check if the 'age' field is less than 'limit' -field("age").lessThan(field('limit')); - -``` - | -| [lessThan(value)](./firestore_lite_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than a constant value. -```typescript -// Check if the 'price' field is less than 50 -field("price").lessThan(50); - -``` - | -| [lessThanOrEqual(expression)](./firestore_lite_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to another expression. -```typescript -// Check if the 'quantity' field is less than or equal to 20 -field("quantity").lessThan(constant(20)); - -``` - | -| [lessThanOrEqual(value)](./firestore_lite_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to a constant value. -```typescript -// Check if the 'score' field is less than or equal to 70 -field("score").lessThan(70); - -``` - | -| [like(pattern)](./firestore_lite_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. -```typescript -// Check if the 'title' field contains the word "guide" (case-sensitive) -field("title").like("%guide%"); - -``` - | -| [like(pattern)](./firestore_lite_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. -```typescript -// Check if the 'title' field contains the word "guide" (case-sensitive) -field("title").like("%guide%"); - -``` - | -| [ln()](./firestore_lite_pipelines.expression.md#expressionln) | | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. -```typescript -// Compute the natural logarithm of the 'value' field. -field("value").ln(); - -``` - A new representing the natural logarithm of the numeric value. | -| [log10()](./firestore_lite_pipelines.expression.md#expressionlog10) | | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. -```typescript -// Compute the base-10 logarithm of the 'value' field. -field("value").log10(); - -``` - A new representing the base-10 logarithm of the numeric value. | -| [logicalMaximum(second, others)](./firestore_lite_pipelines.expression.md#expressionlogicalmaximum) | | (Public Preview) Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. -```typescript -// Returns the larger value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMaximum(Function.currentTimestamp()); - -``` - | -| [logicalMinimum(second, others)](./firestore_lite_pipelines.expression.md#expressionlogicalminimum) | | (Public Preview) Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. -```typescript -// Returns the smaller value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMinimum(Function.currentTimestamp()); - -``` - | -| [mapGet(subfield)](./firestore_lite_pipelines.expression.md#expressionmapget) | | (Public Preview) Accesses a value from a map (object) field using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -field("address").mapGet("city"); - -``` - | -| [mapMerge(secondMap, otherMaps)](./firestore_lite_pipelines.expression.md#expressionmapmerge) | | (Public Preview) Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -field('settings').mapMerge({ enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - | -| [mapRemove(key)](./firestore_lite_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. -``` -// Removes the key 'baz' from the input map. -map({foo: 'bar', baz: true}).mapRemove('baz'); - -``` - | -| [mapRemove(keyExpr)](./firestore_lite_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. -``` -// Removes the key 'baz' from the input map. -map({foo: 'bar', baz: true}).mapRemove(constant('baz')); - -``` - | -| [maximum()](./firestore_lite_pipelines.expression.md#expressionmaximum) | | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -field("score").maximum().as("highestScore"); - -``` - A new AggregateFunction representing the 'maximum' aggregation. | -| [minimum()](./firestore_lite_pipelines.expression.md#expressionminimum) | | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. -```typescript -// Find the lowest price of all products -field("price").minimum().as("lowestPrice"); - -``` - A new AggregateFunction representing the 'minimum' aggregation. | -| [mod(expression)](./firestore_lite_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. -```typescript -// Calculate the remainder of dividing the 'value' field by the 'divisor' field -field("value").mod(field("divisor")); - -``` - | -| [mod(value)](./firestore_lite_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. -```typescript -// Calculate the remainder of dividing the 'value' field by 10 -field("value").mod(10); - -``` - | -| [multiply(second)](./firestore_lite_pipelines.expression.md#expressionmultiply) | | (Public Preview) Creates an expression that multiplies this expression by another expression. -```typescript -// Multiply the 'quantity' field by the 'price' field -field("quantity").multiply(field("price")); - -``` - | -| [notEqual(expression)](./firestore_lite_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to another expression. -```typescript -// Check if the 'status' field is not equal to "completed" -field("status").notEqual("completed"); - -``` - | -| [notEqual(value)](./firestore_lite_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to a constant value. -```typescript -// Check if the 'country' field is not equal to "USA" -field("country").notEqual("USA"); - -``` - | -| [notEqualAny(values)](./firestore_lite_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -field("status").notEqualAny(["pending", field("rejectedStatus")]); - -``` - | -| [notEqualAny(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. -```typescript -// Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' -field("status").notEqualAny(field('rejectedStatuses')); - -``` - | -| [pow(exponent)](./firestore_lite_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of another expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -field("base").pow(field("exponent")); - -``` - | -| [pow(exponent)](./firestore_lite_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of a constant value. -```typescript -// Raise the value of the 'base' field to the power of 2. -field("base").pow(2); - -``` - | -| [regexContains(pattern)](./firestore_lite_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -field("description").regexContains("(?i)example"); - -``` - | -| [regexContains(pattern)](./firestore_lite_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains the regular expression stored in field 'regex' -field("description").regexContains(field("regex")); - -``` - | -| [regexMatch(pattern)](./firestore_lite_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -field("email").regexMatch("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); - -``` - | -| [regexMatch(pattern)](./firestore_lite_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. -```typescript -// Check if the 'email' field matches a regular expression stored in field 'regex' -field("email").regexMatch(field("regex")); - -``` - | -| [reverse()](./firestore_lite_pipelines.expression.md#expressionreverse) | | (Public Preview) Creates an expression that reverses this string expression. -```typescript -// Reverse the value of the 'myString' field. -field("myString").reverse(); - -``` - A new representing the reversed string. | -| [round()](./firestore_lite_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. -```typescript -// Round the value of the 'price' field. -field("price").round(); - -``` - A new Expr representing the rounded value. | -| [round(decimalPlaces)](./firestore_lite_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -field("price").round(2); - -``` - | -| [round(decimalPlaces)](./firestore_lite_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. +| [abs()](./firestore_lite_pipelines.expression.md#expressionabs) | | (Public Preview) Creates an expression that computes the absolute value of a numeric value. | +| [add(second)](./firestore_lite_pipelines.expression.md#expressionadd) | | (Public Preview) Creates an expression that adds this expression to another expression. | +| [arrayConcat(secondArray, otherArrays)](./firestore_lite_pipelines.expression.md#expressionarrayconcat) | | (Public Preview) Creates an expression that concatenates an array expression with one or more other arrays. | +| [arrayContains(expression)](./firestore_lite_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific element. | +| [arrayContains(value)](./firestore_lite_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific value. | +| [arrayContainsAll(values)](./firestore_lite_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. | +| [arrayContainsAll(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. | +| [arrayContainsAny(values)](./firestore_lite_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. | +| [arrayContainsAny(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. | +| [arrayGet(offset)](./firestore_lite_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayGet(offsetExpr)](./firestore_lite_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayLength()](./firestore_lite_pipelines.expression.md#expressionarraylength) | | (Public Preview) Creates an expression that calculates the length of an array. | +| [arrayReverse()](./firestore_lite_pipelines.expression.md#expressionarrayreverse) | | (Public Preview) Creates an expression that reverses an array. | +| [arraySum()](./firestore_lite_pipelines.expression.md#expressionarraysum) | | (Public Preview) Creates an expression that computes the sum of the elements in an array. | +| [as(name)](./firestore_lite_pipelines.expression.md#expressionas) | | (Public Preview) Assigns an alias to this expression.Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values. | +| [asBoolean()](./firestore_lite_pipelines.expression.md#expressionasboolean) | | (Public Preview) Wraps the expression in a \[BooleanExpression\]. | +| [ascending()](./firestore_lite_pipelines.expression.md#expressionascending) | | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on this expression. | +| [average()](./firestore_lite_pipelines.expression.md#expressionaverage) | | (Public Preview) Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. | +| [byteLength()](./firestore_lite_pipelines.expression.md#expressionbytelength) | | (Public Preview) Creates an expression that calculates the length of this string expression in bytes. | +| [ceil()](./firestore_lite_pipelines.expression.md#expressionceil) | | (Public Preview) Creates an expression that computes the ceiling of a numeric value. | +| [charLength()](./firestore_lite_pipelines.expression.md#expressioncharlength) | | (Public Preview) Creates an expression that calculates the character length of a string in UTF-8. | +| [collectionId()](./firestore_lite_pipelines.expression.md#expressioncollectionid) | | (Public Preview) Creates an expression that returns the collection ID from a path. | +| [concat(second, others)](./firestore_lite_pipelines.expression.md#expressionconcat) | | (Public Preview) Creates an expression that concatenates expression results together. | +| [cosineDistance(vectorExpression)](./firestore_lite_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the cosine distance between two vectors. | +| [cosineDistance(vector)](./firestore_lite_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the Cosine distance between two vectors. | +| [count()](./firestore_lite_pipelines.expression.md#expressioncount) | | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. | +| [countDistinct()](./firestore_lite_pipelines.expression.md#expressioncountdistinct) | | (Public Preview) Creates an aggregation that counts the number of distinct values of the expression or field. | +| [descending()](./firestore_lite_pipelines.expression.md#expressiondescending) | | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on this expression. | +| [divide(divisor)](./firestore_lite_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by another expression. | +| [divide(divisor)](./firestore_lite_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by a constant value. | +| [documentId()](./firestore_lite_pipelines.expression.md#expressiondocumentid) | | (Public Preview) Creates an expression that returns the document ID from a path. | +| [dotProduct(vectorExpression)](./firestore_lite_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. | +| [dotProduct(vector)](./firestore_lite_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. | +| [endsWith(suffix)](./firestore_lite_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix. | +| [endsWith(suffix)](./firestore_lite_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix (represented as an expression). | +| [equal(expression)](./firestore_lite_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to another expression. | +| [equal(value)](./firestore_lite_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to a constant value. | +| [equalAny(values)](./firestore_lite_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. | +| [equalAny(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. | +| [euclideanDistance(vectorExpression)](./firestore_lite_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. | +| [euclideanDistance(vector)](./firestore_lite_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. | +| [exists()](./firestore_lite_pipelines.expression.md#expressionexists) | | (Public Preview) Creates an expression that checks if a field exists in the document. | +| [exp()](./firestore_lite_pipelines.expression.md#expressionexp) | | (Public Preview) Creates an expression that computes e to the power of this expression. | +| [floor()](./firestore_lite_pipelines.expression.md#expressionfloor) | | (Public Preview) Creates an expression that computes the floor of a numeric value. | +| [greaterThan(expression)](./firestore_lite_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than another expression. | +| [greaterThan(value)](./firestore_lite_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than a constant value. | +| [greaterThanOrEqual(expression)](./firestore_lite_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to another expression. | +| [greaterThanOrEqual(value)](./firestore_lite_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to a constant value. | +| [ifAbsent(elseValue)](./firestore_lite_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of the this expression evaluation. | +| [ifAbsent(elseExpression)](./firestore_lite_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of this expression evaluation. ```typescript -// Round the value of the 'price' field to two decimal places. -field("price").round(constant(2)); +// Returns the value of the optional field 'optional_field', or if that is +// absent, then returns the value of the field ` +field("optional_field").ifAbsent(field('default_field')) ``` | +| [ifError(catchExpr)](./firestore_lite_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the result of the catchExpr argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_lite_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [isAbsent()](./firestore_lite_pipelines.expression.md#expressionisabsent) | | (Public Preview) Creates an expression that returns true if the result of this expression is absent. Otherwise, returns false even if the value is null. | +| [isError()](./firestore_lite_pipelines.expression.md#expressioniserror) | | (Public Preview) Creates an expression that checks if a given expression produces an error. | +| [join(delimiterExpression)](./firestore_lite_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array into a string. | +| [join(delimiter)](./firestore_lite_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array field into a string. | +| [length()](./firestore_lite_pipelines.expression.md#expressionlength) | | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. | +| [lessThan(experession)](./firestore_lite_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than another expression. | +| [lessThan(value)](./firestore_lite_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than a constant value. | +| [lessThanOrEqual(expression)](./firestore_lite_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to another expression. | +| [lessThanOrEqual(value)](./firestore_lite_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to a constant value. | +| [like(pattern)](./firestore_lite_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. | +| [like(pattern)](./firestore_lite_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. | +| [ln()](./firestore_lite_pipelines.expression.md#expressionln) | | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. | +| [log10()](./firestore_lite_pipelines.expression.md#expressionlog10) | | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. | +| [logicalMaximum(second, others)](./firestore_lite_pipelines.expression.md#expressionlogicalmaximum) | | (Public Preview) Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. | +| [logicalMinimum(second, others)](./firestore_lite_pipelines.expression.md#expressionlogicalminimum) | | (Public Preview) Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. | +| [mapGet(subfield)](./firestore_lite_pipelines.expression.md#expressionmapget) | | (Public Preview) Accesses a value from a map (object) field using the provided key. | +| [mapMerge(secondMap, otherMaps)](./firestore_lite_pipelines.expression.md#expressionmapmerge) | | (Public Preview) Creates an expression that merges multiple map values. | +| [mapRemove(key)](./firestore_lite_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. | +| [mapRemove(keyExpr)](./firestore_lite_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. | +| [maximum()](./firestore_lite_pipelines.expression.md#expressionmaximum) | | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. | +| [minimum()](./firestore_lite_pipelines.expression.md#expressionminimum) | | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. | +| [mod(expression)](./firestore_lite_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. | +| [mod(value)](./firestore_lite_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. | +| [multiply(second)](./firestore_lite_pipelines.expression.md#expressionmultiply) | | (Public Preview) Creates an expression that multiplies this expression by another expression. | +| [notEqual(expression)](./firestore_lite_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to another expression. | +| [notEqual(value)](./firestore_lite_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to a constant value. | +| [notEqualAny(values)](./firestore_lite_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the provided values or expressions. | +| [notEqualAny(arrayExpression)](./firestore_lite_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. | +| [pow(exponent)](./firestore_lite_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of another expression. | +| [pow(exponent)](./firestore_lite_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of a constant value. | +| [regexContains(pattern)](./firestore_lite_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. | +| [regexContains(pattern)](./firestore_lite_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. | +| [regexMatch(pattern)](./firestore_lite_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. | +| [regexMatch(pattern)](./firestore_lite_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. | +| [reverse()](./firestore_lite_pipelines.expression.md#expressionreverse) | | (Public Preview) Creates an expression that reverses this string expression. | +| [round()](./firestore_lite_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. | +| [round(decimalPlaces)](./firestore_lite_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | +| [round(decimalPlaces)](./firestore_lite_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | | [split(delimiter)](./firestore_lite_pipelines.expression.md#expressionsplit) | | (Public Preview) Creates an expression that splits the result of this expression into an array of substrings based on the provided delimiter. | | [split(delimiter)](./firestore_lite_pipelines.expression.md#expressionsplit) | | (Public Preview) Creates an expression that splits the result of this expression into an array of substrings based on the provided delimiter. | -| [sqrt()](./firestore_lite_pipelines.expression.md#expressionsqrt) | | (Public Preview) Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -field("value").sqrt(); - -``` - A new representing the square root of the numeric value. | -| [startsWith(prefix)](./firestore_lite_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix. -```typescript -// Check if the 'name' field starts with "Mr." -field("name").startsWith("Mr."); - -``` - | -| [startsWith(prefix)](./firestore_lite_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix (represented as an expression). -```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -field("fullName").startsWith(field("firstName")); - -``` - | -| [stringConcat(secondString, otherStrings)](./firestore_lite_pipelines.expression.md#expressionstringconcat) | | (Public Preview) Creates an expression that concatenates string expressions together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -field("firstName").stringConcat(constant(" "), field("lastName")); - -``` - | -| [stringContains(substring)](./firestore_lite_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified substring. -```typescript -// Check if the 'description' field contains "example". -field("description").stringContains("example"); - -``` - | -| [stringContains(expr)](./firestore_lite_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains the string represented by another expression. -```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -field("description").stringContains(field("keyword")); - -``` - | -| [stringReverse()](./firestore_lite_pipelines.expression.md#expressionstringreverse) | | (Public Preview) Creates an expression that reverses a string. -```typescript -// Reverse the value of the 'myString' field. -field("myString").stringReverse(); - -``` - A new representing the reversed string. | +| [sqrt()](./firestore_lite_pipelines.expression.md#expressionsqrt) | | (Public Preview) Creates an expression that computes the square root of a numeric value. | +| [startsWith(prefix)](./firestore_lite_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix. | +| [startsWith(prefix)](./firestore_lite_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix (represented as an expression). | +| [stringConcat(secondString, otherStrings)](./firestore_lite_pipelines.expression.md#expressionstringconcat) | | (Public Preview) Creates an expression that concatenates string expressions together. | +| [stringContains(substring)](./firestore_lite_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified substring. | +| [stringContains(expr)](./firestore_lite_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains the string represented by another expression. | +| [stringReverse()](./firestore_lite_pipelines.expression.md#expressionstringreverse) | | (Public Preview) Creates an expression that reverses a string. | | [substring(position, length)](./firestore_lite_pipelines.expression.md#expressionsubstring) | | (Public Preview) Creates an expression that returns a substring of the results of this expression. | | [substring(position, length)](./firestore_lite_pipelines.expression.md#expressionsubstring) | | (Public Preview) Creates an expression that returns a substring of the results of this expression. | -| [subtract(subtrahend)](./firestore_lite_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts another expression from this expression. -```typescript -// Subtract the 'discount' field from the 'price' field -field("price").subtract(field("discount")); - -``` - | -| [subtract(subtrahend)](./firestore_lite_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts a constant value from this expression. -```typescript -// Subtract 20 from the value of the 'total' field -field("total").subtract(20); - -``` - | -| [sum()](./firestore_lite_pipelines.expression.md#expressionsum) | | (Public Preview) Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -field("orderAmount").sum().as("totalRevenue"); - -``` - A new AggregateFunction representing the 'sum' aggregation. | -| [timestampAdd(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. -```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -field("timestamp").timestampAdd(field("unit"), field("amount")); - -``` - | -| [timestampAdd(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. -```typescript -// Add 1 day to the 'timestamp' field. -field("timestamp").timestampAdd("day", 1); - -``` - | -| [timestampSubtract(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. -```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -field("timestamp").timestampSubtract(field("unit"), field("amount")); - -``` - | -| [timestampSubtract(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. -```typescript -// Subtract 1 day from the 'timestamp' field. -field("timestamp").timestampSubtract("day", 1); - -``` - | -| [timestampToUnixMicros()](./firestore_lite_pipelines.expression.md#expressiontimestamptounixmicros) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to microseconds since epoch. -field("timestamp").timestampToUnixMicros(); - -``` - A new representing the number of microseconds since epoch. | -| [timestampToUnixMillis()](./firestore_lite_pipelines.expression.md#expressiontimestamptounixmillis) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -field("timestamp").timestampToUnixMillis(); - -``` - A new representing the number of milliseconds since epoch. | -| [timestampToUnixSeconds()](./firestore_lite_pipelines.expression.md#expressiontimestamptounixseconds) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to seconds since epoch. -field("timestamp").timestampToUnixSeconds(); - -``` - A new representing the number of seconds since epoch. | +| [subtract(subtrahend)](./firestore_lite_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts another expression from this expression. | +| [subtract(subtrahend)](./firestore_lite_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts a constant value from this expression. | +| [sum()](./firestore_lite_pipelines.expression.md#expressionsum) | | (Public Preview) Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs. | +| [timestampAdd(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. | +| [timestampAdd(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. | +| [timestampSubtract(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. | +| [timestampSubtract(unit, amount)](./firestore_lite_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. | +| [timestampToUnixMicros()](./firestore_lite_pipelines.expression.md#expressiontimestamptounixmicros) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixMillis()](./firestore_lite_pipelines.expression.md#expressiontimestamptounixmillis) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixSeconds()](./firestore_lite_pipelines.expression.md#expressiontimestamptounixseconds) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). | | [timestampTruncate(granularity, timezone)](./firestore_lite_pipelines.expression.md#expressiontimestamptruncate) | | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | | [timestampTruncate(granularity, timezone)](./firestore_lite_pipelines.expression.md#expressiontimestamptruncate) | | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | -| [toLower()](./firestore_lite_pipelines.expression.md#expressiontolower) | | (Public Preview) Creates an expression that converts a string to lowercase. -```typescript -// Convert the 'name' field to lowercase -field("name").toLower(); - -``` - A new Expr representing the lowercase string. | -| [toUpper()](./firestore_lite_pipelines.expression.md#expressiontoupper) | | (Public Preview) Creates an expression that converts a string to uppercase. -```typescript -// Convert the 'title' field to uppercase -field("title").toUpper(); - -``` - A new Expr representing the uppercase string. | -| [trim(valueToTrim)](./firestore_lite_pipelines.expression.md#expressiontrim) | | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array. -```typescript -// Trim whitespace from the 'userInput' field -field("userInput").trim(); - -// Trim quotes from the 'userInput' field -field("userInput").trim('"'); - -``` - | +| [toLower()](./firestore_lite_pipelines.expression.md#expressiontolower) | | (Public Preview) Creates an expression that converts a string to lowercase. | +| [toUpper()](./firestore_lite_pipelines.expression.md#expressiontoupper) | | (Public Preview) Creates an expression that converts a string to uppercase. | +| [trim(valueToTrim)](./firestore_lite_pipelines.expression.md#expressiontrim) | | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array. | | [type()](./firestore_lite_pipelines.expression.md#expressiontype) | | (Public Preview) Creates an expression that returns the data type of this expression's result, as a string. | -| [unixMicrosToTimestamp()](./firestore_lite_pipelines.expression.md#expressionunixmicrostotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -field("microseconds").unixMicrosToTimestamp(); - -``` - A new representing the timestamp. | -| [unixMillisToTimestamp()](./firestore_lite_pipelines.expression.md#expressionunixmillistotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -field("milliseconds").unixMillisToTimestamp(); - -``` - A new representing the timestamp. | -| [unixSecondsToTimestamp()](./firestore_lite_pipelines.expression.md#expressionunixsecondstotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'seconds' field as seconds since epoch. -field("seconds").unixSecondsToTimestamp(); - -``` - A new representing the timestamp. | -| [vectorLength()](./firestore_lite_pipelines.expression.md#expressionvectorlength) | | (Public Preview) Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. -```typescript -// Get the vector length (dimension) of the field 'embedding'. -field("embedding").vectorLength(); - -``` - A new representing the length of the vector. | +| [unixMicrosToTimestamp()](./firestore_lite_pipelines.expression.md#expressionunixmicrostotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixMillisToTimestamp()](./firestore_lite_pipelines.expression.md#expressionunixmillistotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixSecondsToTimestamp()](./firestore_lite_pipelines.expression.md#expressionunixsecondstotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [vectorLength()](./firestore_lite_pipelines.expression.md#expressionvectorlength) | | (Public Preview) Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. | ## Expression.expressionType @@ -871,28 +184,53 @@ abstract readonly expressionType: ExpressionType; Creates an expression that computes the absolute value of a numeric value. +Signature: + +```typescript +abs(): FunctionExpression; +``` +Returns: + +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the absolute value of the numeric value. + +### Example + + ```typescript // Compute the absolute value of the 'price' field. field("price").abs(); ``` - A new representing the absolute value of the numeric value. + +## Expression.add() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds this expression to another expression. Signature: ```typescript -abs(): FunctionExpression; +add(second: Expression | unknown): FunctionExpression; ``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The expression or literal to add to this expression. | + Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.add() +A new `Expression` representing the addition operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds this expression to another expression. ```typescript // Add the value of the 'quantity' field and the 'reserve' field. @@ -900,28 +238,34 @@ field("quantity").add(field("reserve")); ``` +## Expression.arrayConcat() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates an array expression with one or more other arrays. + Signature: ```typescript -add(second: Expression | unknown): FunctionExpression; +arrayConcat(secondArray: Expression | unknown[], ...otherArrays: Array): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The expression or literal to add to this expression. | +| secondArray | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\] | Second array expression or array literal to concatenate. | +| otherArrays | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayConcat() +A new `Expression` representing the concatenated array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates an array expression with one or more other arrays. ```typescript // Combine the 'items' array with another array field. @@ -929,29 +273,33 @@ field("items").arrayConcat(field("otherItems")); ``` +## Expression.arrayContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains a specific element. + Signature: ```typescript -arrayConcat(secondArray: Expression | unknown[], ...otherArrays: Array): FunctionExpression; +arrayContains(expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| secondArray | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\] | Second array expression or array literal to concatenate. | -| otherArrays | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. A new Expr representing the concatenated array. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The element to search for in the array. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContains() +A new `Expression` representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains a specific element. ```typescript // Check if the 'sizes' array contains the value from the 'selectedSize' field @@ -959,28 +307,33 @@ field("sizes").arrayContains(field("selectedSize")); ``` +## Expression.arrayContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains a specific value. + Signature: ```typescript -arrayContains(expression: Expression): BooleanExpression; +arrayContains(value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The element to search for in the array. A new Expr representing the 'array\_contains' comparison. | +| value | unknown | The element to search for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContains() +A new `Expression` representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains a specific value. ```typescript // Check if the 'colors' array contains "red" @@ -988,28 +341,33 @@ field("colors").arrayContains("red"); ``` +## Expression.arrayContainsAll() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains all the specified elements. + Signature: ```typescript -arrayContains(value: unknown): BooleanExpression; +arrayContainsAll(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The element to search for in the array. A new Expr representing the 'array\_contains' comparison. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAll() +A new `Expression` representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains all the specified elements. ```typescript // Check if the 'tags' array contains both the value in field "tag1" and the literal value "tag2" @@ -1017,28 +375,33 @@ field("tags").arrayContainsAll([field("tag1"), "tag2"]); ``` +## Expression.arrayContainsAll() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains all the specified elements. + Signature: ```typescript -arrayContainsAll(values: Array): BooleanExpression; +arrayContainsAll(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. A new Expr representing the 'array\_contains\_all' comparison. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAll() +A new `Expression` representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains all the specified elements. ```typescript // Check if the 'tags' array contains both of the values from field "tag1" and the literal value "tag2" @@ -1046,28 +409,33 @@ field("tags").arrayContainsAll(array([field("tag1"), "tag2"])); ``` +## Expression.arrayContainsAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains any of the specified elements. + Signature: ```typescript -arrayContainsAll(arrayExpression: Expression): BooleanExpression; +arrayContainsAny(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The elements to check for in the array. A new Expr representing the 'array\_contains\_all' comparison. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAny() +A new `Expression` representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains any of the specified elements. ```typescript // Check if the 'categories' array contains either values from field "cate1" or "cate2" @@ -1075,28 +443,33 @@ field("categories").arrayContainsAny([field("cate1"), field("cate2")]); ``` +## Expression.arrayContainsAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains any of the specified elements. + Signature: ```typescript -arrayContainsAny(values: Array): BooleanExpression; +arrayContainsAny(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. A new Expr representing the 'array\_contains\_any' comparison. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAny() +A new `Expression` representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains any of the specified elements. ```typescript // Check if the 'groups' array contains either the value from the 'userGroup' field @@ -1105,28 +478,33 @@ field("groups").arrayContainsAny(array([field("userGroup"), "guest"])); ``` +## Expression.arrayGet() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript -arrayContainsAny(arrayExpression: Expression): BooleanExpression; +arrayGet(offset: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The elements to check for in the array. A new Expr representing the 'array\_contains\_any' comparison. | +| offset | number | The index of the element to return. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayGet() +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript // Return the value in the 'tags' field array at index `1`. @@ -1134,28 +512,33 @@ field('tags').arrayGet(1); ``` +## Expression.arrayGet() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript -arrayGet(offset: number): FunctionExpression; +arrayGet(offsetExpr: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| offset | number | The index of the element to return. A new Expr representing the 'arrayGet' operation. | +| offsetExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expression evaluating to the index of the element to return. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayGet() +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript // Return the value in the tags field array at index specified by field @@ -1164,90 +547,86 @@ field('tags').arrayGet(field('favoriteTag')); ``` -Signature: +## Expression.arrayLength() -```typescript -arrayGet(offsetExpr: Expression): FunctionExpression; -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -#### Parameters +Creates an expression that calculates the length of an array. -| Parameter | Type | Description | -| --- | --- | --- | -| offsetExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expr evaluating to the index of the element to return. A new Expr representing the 'arrayGet' operation. | +Signature: +```typescript +arrayLength(): FunctionExpression; +``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayLength() +A new `Expression` representing the length of the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of an array. ```typescript // Get the number of items in the 'cart' array field("cart").arrayLength(); ``` - A new `Expr` representing the length of the array. + +## Expression.arrayReverse() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses an array. Signature: ```typescript -arrayLength(): FunctionExpression; +arrayReverse(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayReverse() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses an array. ```typescript // Reverse the value of the 'myArray' field. field("myArray").arrayReverse(); ``` - A new representing the reversed array. + +## Expression.arraySum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the sum of the elements in an array. Signature: ```typescript -arrayReverse(): FunctionExpression; +arraySum(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.arraySum() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the sum of the elements in the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the sum of the elements in an array. ```typescript // Compute the sum of the elements in the 'scores' field. field("scores").arraySum(); ``` - A new representing the sum of the elements in the array. - -Signature: - -```typescript -arraySum(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) ## Expression.as() @@ -1258,13 +637,6 @@ Assigns an alias to this expression. Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values. -```typescript -// Calculate the total price and assign it the alias "totalPrice" and add it to the output. -firestore.pipeline().collection("items") - .addFields(field("price").multiply(field("quantity")).as("totalPrice")); - -``` - Signature: ```typescript @@ -1275,12 +647,24 @@ as(name: string): AliasedExpression; | Parameter | Type | Description | | --- | --- | --- | -| name | string | The alias to assign to this expression. A new that wraps this expression and associates it with the provided alias. | +| name | string | The alias to assign to this expression. | Returns: [AliasedExpression](./firestore_lite_pipelines.aliasedexpression.md#aliasedexpression_class) +A new [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class) that wraps this expression and associates it with the provided alias. + +### Example + + +```typescript +// Calculate the total price and assign it the alias "totalPrice" and add it to the output. +firestore.pipeline().collection("items") + .addFields(field("price").multiply(field("quantity")).as("totalPrice")); + +``` + ## Expression.asBoolean() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1288,8 +672,6 @@ as(name: string): AliasedExpression; Wraps the expression in a \[BooleanExpression\]. - A \[BooleanExpression\] representing the same expression. - Signature: ```typescript @@ -1299,12 +681,28 @@ asBoolean(): BooleanExpression; [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +A \[BooleanExpression\] representing the same expression. + ## Expression.ascending() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an that sorts documents in ascending order based on this expression. +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on this expression. + +Signature: + +```typescript +ascending(): Ordering; +``` +Returns: + +[Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) + +A new `Ordering` for ascending sorting. + +### Example + ```typescript // Sort documents by the 'name' field in ascending order @@ -1312,131 +710,141 @@ pipeline().collection("users") .sort(field("name").ascending()); ``` - A new `Ordering` for ascending sorting. + +## Expression.average() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. Signature: ```typescript -ascending(): Ordering; +average(): AggregateFunction; ``` Returns: -[Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.average() +A new `AggregateFunction` representing the 'average' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. ```typescript // Calculate the average age of users field("age").average().as("averageAge"); ``` - A new `AggregateFunction` representing the 'average' aggregation. + +## Expression.byteLength() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of this string expression in bytes. Signature: ```typescript -average(): AggregateFunction; +byteLength(): FunctionExpression; ``` Returns: -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.byteLength() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string in bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of this string expression in bytes. ```typescript // Calculate the length of the 'myString' field in bytes. field("myString").byteLength(); ``` - A new representing the length of the string in bytes. + +## Expression.ceil() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the ceiling of a numeric value. Signature: ```typescript -byteLength(): FunctionExpression; +ceil(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.ceil() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the ceiling of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the ceiling of a numeric value. ```typescript // Compute the ceiling of the 'price' field. field("price").ceil(); ``` - A new representing the ceiling of the numeric value. + +## Expression.charLength() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the character length of a string in UTF-8. Signature: ```typescript -ceil(): FunctionExpression; +charLength(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.charLength() +A new `Expression` representing the length of the string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the character length of a string in UTF-8. ```typescript // Get the character length of the 'name' field in its UTF-8 form. field("name").charLength(); ``` - A new `Expr` representing the length of the string. + +## Expression.collectionId() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the collection ID from a path. Signature: ```typescript -charLength(): FunctionExpression; +collectionId(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.collectionId() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the collectionId operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the collection ID from a path. ```typescript // Get the collection ID from a path. field("__path__").collectionId(); ``` - A new representing the collectionId operation. - -Signature: - -```typescript -collectionId(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) ## Expression.concat() @@ -1445,12 +853,6 @@ collectionId(): FunctionExpression; Creates an expression that concatenates expression results together. -```typescript -// Combine the 'firstName', ' ', and 'lastName' fields into a single value. -field("firstName").concat(constant(" "), field("lastName")); - -``` - Signature: ```typescript @@ -1462,25 +864,30 @@ concat(second: Expression | unknown, ...others: Array): Fu | Parameter | Type | Description | | --- | --- | --- | | second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The additional expression or literal to concatenate. | -| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals to concatenate. A new Expr representing the concatenated value. | +| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.cosineDistance() +A new `Expression` representing the concatenated value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the cosine distance between two vectors. ```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -field("userVector").cosineDistance(field("itemVector")); +// Combine the 'firstName', ' ', and 'lastName' fields into a single value. +field("firstName").concat(constant(" "), field("lastName")); ``` +## Expression.cosineDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the cosine distance between two vectors. + Signature: ```typescript @@ -1491,25 +898,30 @@ cosineDistance(vectorExpression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new Expr representing the cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.cosineDistance() +A new `Expression` representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between two vectors. ```typescript -// Calculate the Cosine distance between the 'location' field and a target location -field("location").cosineDistance(new VectorValue([37.7749, -122.4194])); +// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field +field("userVector").cosineDistance(field("itemVector")); ``` +## Expression.cosineDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between two vectors. + Signature: ```typescript @@ -1520,25 +932,29 @@ cosineDistance(vector: VectorValue | number[]): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| vector | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. A new Expr representing the Cosine\* distance between the two vectors. | +| vector | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.count() +A new `Expression` representing the Cosine\* distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. ```typescript -// Count the total number of products -field("productId").count().as("totalProducts"); +// Calculate the Cosine distance between the 'location' field and a target location +field("location").cosineDistance(new VectorValue([37.7749, -122.4194])); ``` - A new `AggregateFunction` representing the 'count' aggregation. + +## Expression.count() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. Signature: @@ -1549,19 +965,23 @@ count(): AggregateFunction; [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.countDistinct() +A new `AggregateFunction` representing the 'count' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of distinct values of the expression or field. ```typescript -// Count the distinct number of products -field("productId").countDistinct().as("distinctProducts"); +// Count the total number of products +field("productId").count().as("totalProducts"); ``` - A new `AggregateFunction` representing the 'count\_distinct' aggregation. + +## Expression.countDistinct() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of distinct values of the expression or field. Signature: @@ -1572,20 +992,23 @@ countDistinct(): AggregateFunction; [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.descending() +A new `AggregateFunction` representing the 'count\_distinct' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an that sorts documents in descending order based on this expression. ```typescript -// Sort documents by the 'createdAt' field in descending order -firestore.pipeline().collection("users") - .sort(field("createdAt").descending()); +// Count the distinct number of products +field("productId").countDistinct().as("distinctProducts"); ``` - A new `Ordering` for descending sorting. + +## Expression.descending() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on this expression. Signature: @@ -1596,19 +1019,25 @@ descending(): Ordering; [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) -## Expression.divide() +A new `Ordering` for descending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides this expression by another expression. ```typescript -// Divide the 'total' field by the 'count' field -field("total").divide(field("count")); +// Sort documents by the 'createdAt' field in descending order +firestore.pipeline().collection("users") + .sort(field("createdAt").descending()); ``` +## Expression.divide() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides this expression by another expression. + Signature: ```typescript @@ -1619,25 +1048,30 @@ divide(divisor: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| divisor | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. A new Expr representing the division operation. | +| divisor | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.divide() +A new `Expression` representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides this expression by a constant value. ```typescript -// Divide the 'value' field by 10 -field("value").divide(10); +// Divide the 'total' field by the 'count' field +field("total").divide(field("count")); ``` +## Expression.divide() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides this expression by a constant value. + Signature: ```typescript @@ -1648,12 +1082,23 @@ divide(divisor: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| divisor | number | The constant value to divide by. A new Expr representing the division operation. | +| divisor | number | The constant value to divide by. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the division operation. + +### Example + + +```typescript +// Divide the 'value' field by 10 +field("value").divide(10); + +``` + ## Expression.documentId() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1661,28 +1106,53 @@ divide(divisor: number): FunctionExpression; Creates an expression that returns the document ID from a path. +Signature: + +```typescript +documentId(): FunctionExpression; +``` +Returns: + +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the documentId operation. + +### Example + + ```typescript // Get the document ID from a path. field("__path__").documentId(); ``` - A new representing the documentId operation. + +## Expression.dotProduct() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between two vectors. Signature: ```typescript -documentId(): FunctionExpression; +dotProduct(vectorExpression: Expression): FunctionExpression; ``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. | + Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.dotProduct() +A new `Expression` representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between two vectors. ```typescript // Calculate the dot product between a feature vector and a target vector @@ -1690,28 +1160,33 @@ field("features").dotProduct([0.5, 0.8, 0.2]); ``` +## Expression.dotProduct() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between two vectors. + Signature: ```typescript -dotProduct(vectorExpression: Expression): FunctionExpression; +dotProduct(vector: VectorValue | number[]): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. A new Expr representing the dot product between the two vectors. | +| vector | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as an array of numbers) to calculate with. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.dotProduct() +A new `Expression` representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between two vectors. ```typescript // Calculate the dot product between a feature vector and a target vector @@ -1719,28 +1194,33 @@ field("features").dotProduct(new VectorValue([0.5, 0.8, 0.2])); ``` +## Expression.endsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string ends with a given postfix. + Signature: ```typescript -dotProduct(vector: VectorValue | number[]): FunctionExpression; +endsWith(suffix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| vector | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as an array of numbers) to calculate with. A new Expr representing the dot product between the two vectors. | +| suffix | string | The postfix to check for. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.endsWith() +A new `Expression` representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string ends with a given postfix. ```typescript // Check if the 'filename' field ends with ".txt" @@ -1748,28 +1228,33 @@ field("filename").endsWith(".txt"); ``` +## Expression.endsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string ends with a given postfix (represented as an expression). + Signature: ```typescript -endsWith(suffix: string): BooleanExpression; +endsWith(suffix: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| suffix | string | The postfix to check for. A new Expr representing the 'ends with' comparison. | +| suffix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The postfix expression to check for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.endsWith() +A new `Expression` representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string ends with a given postfix (represented as an expression). ```typescript // Check if the 'url' field ends with the value of the 'extension' field @@ -1777,28 +1262,33 @@ field("url").endsWith(field("extension")); ``` +## Expression.equal() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to another expression. + Signature: ```typescript -endsWith(suffix: Expression): BooleanExpression; +equal(expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| suffix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The postfix expression to check for. A new Expr representing the 'ends with' comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for equality. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equal() +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to another expression. ```typescript // Check if the 'age' field is equal to 21 @@ -1806,28 +1296,33 @@ field("age").equal(21); ``` +## Expression.equal() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to a constant value. + Signature: ```typescript -equal(expression: Expression): BooleanExpression; +equal(value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for equality. A new Expr representing the equality comparison. | +| value | unknown | The constant value to compare for equality. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equal() +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to a constant value. ```typescript // Check if the 'city' field is equal to "London" @@ -1835,28 +1330,33 @@ field("city").equal("London"); ``` +## Expression.equalAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to any of the provided values or expressions. + Signature: ```typescript -equal(value: unknown): BooleanExpression; +equalAny(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for equality. A new Expr representing the equality comparison. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equalAny() +A new `Expression` representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -1864,28 +1364,33 @@ field("category").equalAny("Electronics", field("primaryType")); ``` +## Expression.equalAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to any of the provided values or expressions. + Signature: ```typescript -equalAny(values: Array): BooleanExpression; +equalAny(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. A new Expr representing the 'IN' comparison. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array of values to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equalAny() +A new `Expression` representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -1893,28 +1398,33 @@ field("category").equalAny(array(["Electronics", field("primaryType")])); ``` +## Expression.euclideanDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between two vectors. + Signature: ```typescript -equalAny(arrayExpression: Expression): BooleanExpression; +euclideanDistance(vectorExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array of values to check against. A new Expr representing the 'IN' comparison. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.euclideanDistance() +A new `Expression` representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between two vectors. ```typescript // Calculate the Euclidean distance between the 'location' field and a target location @@ -1922,28 +1432,33 @@ field("location").euclideanDistance([37.7749, -122.4194]); ``` +## Expression.euclideanDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between two vectors. + Signature: ```typescript -euclideanDistance(vectorExpression: Expression): FunctionExpression; +euclideanDistance(vector: VectorValue | number[]): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. A new Expr representing the Euclidean distance between the two vectors. | +| vector | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.euclideanDistance() +A new `Expression` representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between two vectors. ```typescript // Calculate the Euclidean distance between the 'location' field and a target location @@ -1951,90 +1466,86 @@ field("location").euclideanDistance(new VectorValue([37.7749, -122.4194])); ``` -Signature: +## Expression.exists() -```typescript -euclideanDistance(vector: VectorValue | number[]): FunctionExpression; -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -#### Parameters +Creates an expression that checks if a field exists in the document. -| Parameter | Type | Description | -| --- | --- | --- | -| vector | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. A new Expr representing the Euclidean distance between the two vectors. | +Signature: +```typescript +exists(): BooleanExpression; +``` Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.exists() +A new `Expression` representing the 'exists' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field exists in the document. ```typescript // Check if the document has a field named "phoneNumber" field("phoneNumber").exists(); ``` - A new `Expr` representing the 'exists' check. + +## Expression.exp() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes e to the power of this expression. Signature: ```typescript -exists(): BooleanExpression; +exp(): FunctionExpression; ``` Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.exp() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the exp of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes e to the power of this expression. ```typescript // Compute e to the power of the 'value' field. field("value").exp(); ``` - A new representing the exp of the numeric value. + +## Expression.floor() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the floor of a numeric value. Signature: ```typescript -exp(): FunctionExpression; +floor(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.floor() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the floor of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the floor of a numeric value. ```typescript // Compute the floor of the 'price' field. field("price").floor(); ``` - A new representing the floor of the numeric value. - -Signature: - -```typescript -floor(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) ## Expression.greaterThan() @@ -2043,12 +1554,6 @@ floor(): FunctionExpression; Creates an expression that checks if this expression is greater than another expression. -```typescript -// Check if the 'age' field is greater than the 'limit' field -field("age").greaterThan(field("limit")); - -``` - Signature: ```typescript @@ -2059,25 +1564,30 @@ greaterThan(expression: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for greater than. A new Expr representing the greater than comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for greater than. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.greaterThan() +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is greater than a constant value. ```typescript -// Check if the 'price' field is greater than 100 -field("price").greaterThan(100); +// Check if the 'age' field is greater than the 'limit' field +field("age").greaterThan(field("limit")); ``` +## Expression.greaterThan() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is greater than a constant value. + Signature: ```typescript @@ -2088,25 +1598,30 @@ greaterThan(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for greater than. A new Expr representing the greater than comparison. | +| value | unknown | The constant value to compare for greater than. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.greaterThanOrEqual() +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is greater than or equal to another expression. ```typescript -// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1 -field("quantity").greaterThanOrEqual(field('requirement').add(1)); +// Check if the 'price' field is greater than 100 +field("price").greaterThan(100); ``` +## Expression.greaterThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is greater than or equal to another expression. + Signature: ```typescript @@ -2117,25 +1632,30 @@ greaterThanOrEqual(expression: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for greater than or equal to. A new Expr representing the greater than or equal to comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for greater than or equal to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.greaterThanOrEqual() +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is greater than or equal to a constant value. ```typescript -// Check if the 'score' field is greater than or equal to 80 -field("score").greaterThanOrEqual(80); +// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1 +field("quantity").greaterThanOrEqual(field('requirement').add(1)); ``` +## Expression.greaterThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is greater than or equal to a constant value. + Signature: ```typescript @@ -2146,26 +1666,30 @@ greaterThanOrEqual(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for greater than or equal to. A new Expr representing the greater than or equal to comparison. | +| value | unknown | The constant value to compare for greater than or equal to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.ifAbsent() +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `elseValue` argument if this expression results in an absent value, else return the result of the this expression evaluation. ```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -field("optional_field").ifAbsent("default_value") +// Check if the 'score' field is greater than or equal to 80 +field("score").greaterThanOrEqual(80); ``` +## Expression.ifAbsent() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `elseValue` argument if this expression results in an absent value, else return the result of the this expression evaluation. + Signature: ```typescript @@ -2176,12 +1700,24 @@ ifAbsent(elseValue: unknown): Expression; | Parameter | Type | Description | | --- | --- | --- | -| elseValue | unknown | The value that will be returned if this Expression evaluates to an absent value. A new \[Expression\] representing the ifAbsent operation. | +| elseValue | unknown | The value that will be returned if this Expression evaluates to an absent value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new \[Expression\] representing the ifAbsent operation. + +### Example + + +```typescript +// Returns the value of the optional field 'optional_field', or returns 'default_value' +// if the field is absent. +field("optional_field").ifAbsent("default_value") + +``` + ## Expression.ifAbsent() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2206,12 +1742,14 @@ ifAbsent(elseExpression: unknown): Expression; | Parameter | Type | Description | | --- | --- | --- | -| elseExpression | unknown | The Expression that will be evaluated if this Expression evaluates to an absent value. A new \[Expression\] representing the ifAbsent operation. | +| elseExpression | unknown | The Expression that will be evaluated if this Expression evaluates to an absent value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new \[Expression\] representing the ifAbsent operation. + ## Expression.ifError() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2219,13 +1757,6 @@ ifAbsent(elseExpression: unknown): Expression; Creates an expression that returns the result of the `catchExpr` argument if there is an error, else return the result of this expression. -```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -field("title").arrayGet(0).ifError(field("title")); - -``` - Signature: ```typescript @@ -2236,25 +1767,30 @@ ifError(catchExpr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript // Returns the first item in the title field arrays, or returns -// "Default Title" -field("title").arrayGet(0).ifError("Default Title"); +// the entire title field if the array is empty or the field is another type. +field("title").arrayGet(0).ifError(field("title")); + +``` + +## Expression.ifError() -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. Signature: @@ -2266,25 +1802,30 @@ ifError(catchValue: unknown): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | unknown | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | unknown | The value that will be returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.isAbsent() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns `true` if the result of this expression is absent. Otherwise, returns `false` even if the value is `null`. ```typescript -// Check if the field `value` is absent. -field("value").isAbsent(); +// Returns the first item in the title field arrays, or returns +// "Default Title" +field("title").arrayGet(0).ifError("Default Title"); ``` - A new representing the 'isAbsent' check. + +## Expression.isAbsent() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns `true` if the result of this expression is absent. Otherwise, returns `false` even if the value is `null`. Signature: @@ -2295,19 +1836,24 @@ isAbsent(): BooleanExpression; [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.isError() +A new [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) representing the 'isAbsent' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a given expression produces an error. ```typescript -// Check if the result of a calculation is an error -field("title").arrayContains(1).isError(); +// Check if the field `value` is absent. +field("value").isAbsent(); +@example ``` - A new representing the 'isError' check. + +## Expression.isError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a given expression produces an error. Signature: @@ -2318,19 +1864,24 @@ isError(): BooleanExpression; [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.join() +A new [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) representing the 'isError' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -field("tags").join(field("separator")) +// Check if the result of a calculation is an error +field("title").arrayContains(1).isError(); ``` +## Expression.join() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array into a string. + Signature: ```typescript @@ -2341,25 +1892,30 @@ join(delimiterExpression: Expression): Expression; | Parameter | Type | Description | | --- | --- | --- | -| delimiterExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. A new Expression representing the join operation. | +| delimiterExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) -## Expression.join() +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array field into a string. ```typescript -// Join the elements of the 'tags' field with a comma and space. -field("tags").join(", ") +// Join the elements of the 'tags' field with the delimiter from the 'separator' field. +field("tags").join(field("separator")) ``` +## Expression.join() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array field into a string. + Signature: ```typescript @@ -2370,28 +1926,29 @@ join(delimiter: string): Expression; | Parameter | Type | Description | | --- | --- | --- | -| delimiter | string | The string to use as a delimiter. A new Expression representing the join operation. | +| delimiter | string | The string to use as a delimiter. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) -## Expression.length() +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string, array, map, vector, or bytes. ```typescript -// Get the length of the 'name' field. -field("name").length(); - -// Get the number of items in the 'cart' array. -field("cart").length(); +// Join the elements of the 'tags' field with a comma and space. +field("tags").join(", ") ``` - A new `Expr` representing the length of the string, array, map, vector, or bytes. + +## Expression.length() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string, array, map, vector, or bytes. Signature: @@ -2402,19 +1959,27 @@ length(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.lessThan() +A new `Expression` representing the length of the string, array, map, vector, or bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than another expression. ```typescript -// Check if the 'age' field is less than 'limit' -field("age").lessThan(field('limit')); +// Get the length of the 'name' field. +field("name").length(); + +// Get the number of items in the 'cart' array. +field("cart").length(); ``` +## Expression.lessThan() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than another expression. + Signature: ```typescript @@ -2425,25 +1990,30 @@ lessThan(experession: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| experession | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for less than. A new Expr representing the less than comparison. | +| experession | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for less than. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.lessThan() +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than a constant value. ```typescript -// Check if the 'price' field is less than 50 -field("price").lessThan(50); +// Check if the 'age' field is less than 'limit' +field("age").lessThan(field('limit')); ``` +## Expression.lessThan() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than a constant value. + Signature: ```typescript @@ -2454,25 +2024,30 @@ lessThan(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for less than. A new Expr representing the less than comparison. | +| value | unknown | The constant value to compare for less than. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.lessThanOrEqual() +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than or equal to another expression. ```typescript -// Check if the 'quantity' field is less than or equal to 20 -field("quantity").lessThan(constant(20)); +// Check if the 'price' field is less than 50 +field("price").lessThan(50); ``` +## Expression.lessThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than or equal to another expression. + Signature: ```typescript @@ -2483,25 +2058,30 @@ lessThanOrEqual(expression: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for less than or equal to. A new Expr representing the less than or equal to comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for less than or equal to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.lessThanOrEqual() +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than or equal to a constant value. ```typescript -// Check if the 'score' field is less than or equal to 70 -field("score").lessThan(70); +// Check if the 'quantity' field is less than or equal to 20 +field("quantity").lessThan(constant(20)); ``` +## Expression.lessThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than or equal to a constant value. + Signature: ```typescript @@ -2512,25 +2092,30 @@ lessThanOrEqual(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for less than or equal to. A new Expr representing the less than or equal to comparison. | +| value | unknown | The constant value to compare for less than or equal to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.like() +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive string comparison. ```typescript -// Check if the 'title' field contains the word "guide" (case-sensitive) -field("title").like("%guide%"); +// Check if the 'score' field is less than or equal to 70 +field("score").lessThan(70); ``` +## Expression.like() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive string comparison. + Signature: ```typescript @@ -2541,18 +2126,16 @@ like(pattern: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| pattern | string | The pattern to search for. You can use "%" as a wildcard character. A new Expr representing the 'like' comparison. | +| pattern | string | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.like() +A new `Expression` representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive string comparison. ```typescript // Check if the 'title' field contains the word "guide" (case-sensitive) @@ -2560,6 +2143,13 @@ field("title").like("%guide%"); ``` +## Expression.like() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive string comparison. + Signature: ```typescript @@ -2570,25 +2160,29 @@ like(pattern: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. A new Expr representing the 'like' comparison. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.ln() +A new `Expression` representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the natural logarithm of a numeric value. ```typescript -// Compute the natural logarithm of the 'value' field. -field("value").ln(); +// Check if the 'title' field contains the word "guide" (case-sensitive) +field("title").like("%guide%"); ``` - A new representing the natural logarithm of the numeric value. + +## Expression.ln() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the natural logarithm of a numeric value. Signature: @@ -2599,19 +2193,23 @@ ln(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.log10() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the natural logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the base-10 logarithm of a numeric value. ```typescript -// Compute the base-10 logarithm of the 'value' field. -field("value").log10(); +// Compute the natural logarithm of the 'value' field. +field("value").ln(); ``` - A new representing the base-10 logarithm of the numeric value. + +## Expression.log10() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the base-10 logarithm of a numeric value. Signature: @@ -2622,19 +2220,24 @@ log10(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.logicalMaximum() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the base-10 logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. ```typescript -// Returns the larger value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMaximum(Function.currentTimestamp()); +// Compute the base-10 logarithm of the 'value' field. +field("value").log10(); ``` +## Expression.logicalMaximum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. + Signature: ```typescript @@ -2646,25 +2249,30 @@ logicalMaximum(second: Expression | unknown, ...others: ArrayReturns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.logicalMinimum() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical maximum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. ```typescript -// Returns the smaller value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMinimum(Function.currentTimestamp()); +// Returns the larger value between the 'timestamp' field and the current timestamp. +field("timestamp").logicalMaximum(Function.currentTimestamp()); ``` +## Expression.logicalMinimum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. + Signature: ```typescript @@ -2676,11 +2284,22 @@ logicalMinimum(second: Expression | unknown, ...others: ArrayReturns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical minimum operation. + +### Example + + +```typescript +// Returns the smaller value between the 'timestamp' field and the current timestamp. +field("timestamp").logicalMinimum(Function.currentTimestamp()); + +``` ## Expression.mapGet() @@ -2689,12 +2308,6 @@ logicalMinimum(second: Expression | unknown, ...others: ArraySignature: ```typescript @@ -2705,12 +2318,23 @@ mapGet(subfield: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| subfield | string | The key to access in the map. A new Expr representing the value associated with the given key in the map. | +| subfield | string | The key to access in the map. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the value associated with the given key in the map. + +### Example + + +```typescript +// Get the 'city' value from the 'address' map field +field("address").mapGet("city"); + +``` + ## Expression.mapMerge() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2718,13 +2342,6 @@ mapGet(subfield: string): FunctionExpression; Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -field('settings').mapMerge({ enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - Signature: ```typescript @@ -2742,7 +2359,17 @@ mapMerge(secondMap: Record | Expression, ...otherMaps: ArraySignature: ```typescript @@ -2773,21 +2394,24 @@ mapRemove(key: string): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -A new representing the 'mapRemove' operation. - -## Expression.mapRemove() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'mapRemove' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes a key from the map produced by evaluating this expression. ``` // Removes the key 'baz' from the input map. -map({foo: 'bar', baz: true}).mapRemove(constant('baz')); +map({foo: 'bar', baz: true}).mapRemove('baz'); ``` +## Expression.mapRemove() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes a key from the map produced by evaluating this expression. + Signature: ```typescript @@ -2804,7 +2428,17 @@ mapRemove(keyExpr: Expression): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -A new representing the 'mapRemove' operation. +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'mapRemove' operation. + +### Example + + +``` +// Removes the key 'baz' from the input map. +map({foo: 'bar', baz: true}).mapRemove(constant('baz')); +@example + +``` ## Expression.maximum() @@ -2813,51 +2447,80 @@ A new representing the 'mapRemove' operation. Creates an aggregation that finds the maximum value of a field across multiple stage inputs. +Signature: + +```typescript +maximum(): AggregateFunction; +``` +Returns: + +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) + +A new `AggregateFunction` representing the 'maximum' aggregation. + +### Example + + ```typescript // Find the highest score in a leaderboard field("score").maximum().as("highestScore"); ``` - A new `AggregateFunction` representing the 'maximum' aggregation. + +## Expression.minimum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the minimum value of a field across multiple stage inputs. Signature: ```typescript -maximum(): AggregateFunction; +minimum(): AggregateFunction; ``` Returns: [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.minimum() +A new `AggregateFunction` representing the 'minimum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the minimum value of a field across multiple stage inputs. ```typescript // Find the lowest price of all products field("price").minimum().as("lowestPrice"); ``` - A new `AggregateFunction` representing the 'minimum' aggregation. + +## Expression.mod() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. Signature: ```typescript -minimum(): AggregateFunction; +mod(expression: Expression): FunctionExpression; ``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. | + Returns: -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.mod() +A new `Expression` representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. ```typescript // Calculate the remainder of dividing the 'value' field by the 'divisor' field @@ -2865,28 +2528,33 @@ field("value").mod(field("divisor")); ``` +## Expression.mod() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. + Signature: ```typescript -mod(expression: Expression): FunctionExpression; +mod(value: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. A new Expr representing the modulo operation. | +| value | number | The constant value to divide by. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.mod() +A new `Expression` representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. ```typescript // Calculate the remainder of dividing the 'value' field by 10 @@ -2894,28 +2562,33 @@ field("value").mod(10); ``` +## Expression.multiply() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that multiplies this expression by another expression. + Signature: ```typescript -mod(value: number): FunctionExpression; +multiply(second: Expression | number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | number | The constant value to divide by. A new Expr representing the modulo operation. | +| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| number | The second expression or literal to multiply by. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.multiply() +A new `Expression` representing the multiplication operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that multiplies this expression by another expression. ```typescript // Multiply the 'quantity' field by the 'price' field @@ -2923,28 +2596,33 @@ field("quantity").multiply(field("price")); ``` +## Expression.notEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to another expression. + Signature: ```typescript -multiply(second: Expression | number): FunctionExpression; +notEqual(expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| number | The second expression or literal to multiply by. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for inequality. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqual() +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to another expression. ```typescript // Check if the 'status' field is not equal to "completed" @@ -2952,28 +2630,33 @@ field("status").notEqual("completed"); ``` +## Expression.notEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to a constant value. + Signature: ```typescript -notEqual(expression: Expression): BooleanExpression; +notEqual(value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare for inequality. A new Expr representing the inequality comparison. | +| value | unknown | The constant value to compare for inequality. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqual() +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to a constant value. ```typescript // Check if the 'country' field is not equal to "USA" @@ -2981,28 +2664,33 @@ field("country").notEqual("USA"); ``` +## Expression.notEqualAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to any of the provided values or expressions. + Signature: ```typescript -notEqual(value: unknown): BooleanExpression; +notEqualAny(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for inequality. A new Expr representing the inequality comparison. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqualAny() +A new `Expression` representing the 'notEqualAny' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to any of the provided values or expressions. ```typescript // Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' @@ -3010,28 +2698,33 @@ field("status").notEqualAny(["pending", field("rejectedStatus")]); ``` +## Expression.notEqualAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. + Signature: ```typescript -notEqualAny(values: Array): BooleanExpression; +notEqualAny(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. A new Expr representing the 'notEqualAny' comparison. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The values or expressions to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqualAny() +A new `Expression` representing the 'notEqualAny' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. ```typescript // Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' @@ -3039,28 +2732,33 @@ field("status").notEqualAny(field('rejectedStatuses')); ``` +## Expression.pow() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of this expression raised to the power of another expression. + Signature: ```typescript -notEqualAny(arrayExpression: Expression): BooleanExpression; +pow(exponent: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The values or expressions to check against. A new Expr representing the 'notEqualAny' comparison. | +| exponent | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise this expression to the power of. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.pow() +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of this expression raised to the power of another expression. ```typescript // Raise the value of the 'base' field to the power of the 'exponent' field. @@ -3068,28 +2766,33 @@ field("base").pow(field("exponent")); ``` +## Expression.pow() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of this expression raised to the power of a constant value. + Signature: ```typescript -pow(exponent: Expression): FunctionExpression; +pow(exponent: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| exponent | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise this expression to the power of. A new Expr representing the power operation. | +| exponent | number | The constant value to raise this expression to the power of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.pow() +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of this expression raised to the power of a constant value. ```typescript // Raise the value of the 'base' field to the power of 2. @@ -3097,57 +2800,67 @@ field("base").pow(2); ``` +## Expression.regexContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains a specified regular expression as a substring. + Signature: ```typescript -pow(exponent: number): FunctionExpression; +regexContains(pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| exponent | number | The constant value to raise this expression to the power of. A new Expr representing the power operation. | +| pattern | string | The regular expression to use for the search. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexContains() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) field("description").regexContains("(?i)example"); -``` +``` + +## Expression.regexContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains a specified regular expression as a substring. Signature: ```typescript -regexContains(pattern: string): BooleanExpression; +regexContains(pattern: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pattern | string | The regular expression to use for the search. A new Expr representing the 'contains' comparison. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexContains() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains the regular expression stored in field 'regex' @@ -3155,28 +2868,33 @@ field("description").regexContains(field("regex")); ``` +## Expression.regexMatch() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string matches a specified regular expression. + Signature: ```typescript -regexContains(pattern: Expression): BooleanExpression; +regexMatch(pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the search. A new Expr representing the 'contains' comparison. | +| pattern | string | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexMatch() +A new `Expression` representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -3184,28 +2902,33 @@ field("email").regexMatch("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); ``` +## Expression.regexMatch() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string matches a specified regular expression. + Signature: ```typescript -regexMatch(pattern: string): BooleanExpression; +regexMatch(pattern: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pattern | string | The regular expression to use for the match. A new Expr representing the regular expression match. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexMatch() +A new `Expression` representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string matches a specified regular expression. ```typescript // Check if the 'email' field matches a regular expression stored in field 'regex' @@ -3213,67 +2936,59 @@ field("email").regexMatch(field("regex")); ``` -Signature: +## Expression.reverse() -```typescript -regexMatch(pattern: Expression): BooleanExpression; -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -#### Parameters +Creates an expression that reverses this string expression. -| Parameter | Type | Description | -| --- | --- | --- | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the match. A new Expr representing the regular expression match. | +Signature: +```typescript +reverse(): FunctionExpression; +``` Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.reverse() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses this string expression. ```typescript // Reverse the value of the 'myString' field. field("myString").reverse(); ``` - A new representing the reversed string. + +## Expression.round() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the nearest whole number. Signature: ```typescript -reverse(): FunctionExpression; +round(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.round() +A new `Expression` representing the rounded value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the nearest whole number. ```typescript // Round the value of the 'price' field. field("price").round(); ``` - A new `Expr` representing the rounded value. - -Signature: - -```typescript -round(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) ## Expression.round() @@ -3282,12 +2997,6 @@ round(): FunctionExpression; Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -field("price").round(2); - -``` - Signature: ```typescript @@ -3298,25 +3007,30 @@ round(decimalPlaces: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| decimalPlaces | number | A constant specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | number | A constant specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.round() +A new `Expression` representing the rounded value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the specified number of decimal places. ```typescript // Round the value of the 'price' field to two decimal places. -field("price").round(constant(2)); +field("price").round(2); ``` +## Expression.round() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the specified number of decimal places. + Signature: ```typescript @@ -3327,12 +3041,23 @@ round(decimalPlaces: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| decimalPlaces | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the rounded value. + +### Example + + +```typescript +// Round the value of the 'price' field to two decimal places. +field("price").round(constant(2)); + +``` + ## Expression.split() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3356,6 +3081,8 @@ split(delimiter: string): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3364,7 +3091,6 @@ split(delimiter: string): FunctionExpression; field('scoresCsv').split(',') ``` - A new representing the split function. ## Expression.split() @@ -3389,6 +3115,8 @@ split(delimiter: Expression): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3397,7 +3125,6 @@ split(delimiter: Expression): FunctionExpression; field('scores').split(conditional(field('format').equal('csv'), constant(','), constant(':')) ``` - A new representing the split function. ## Expression.sqrt() @@ -3406,13 +3133,6 @@ field('scores').split(conditional(field('format').equal('csv'), constant(','), c Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -field("value").sqrt(); - -``` - A new representing the square root of the numeric value. - Signature: ```typescript @@ -3422,19 +3142,24 @@ sqrt(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.startsWith() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the square root of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string starts with a given prefix. ```typescript -// Check if the 'name' field starts with "Mr." -field("name").startsWith("Mr."); +// Compute the square root of the 'value' field. +field("value").sqrt(); ``` +## Expression.startsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string starts with a given prefix. + Signature: ```typescript @@ -3445,25 +3170,30 @@ startsWith(prefix: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| prefix | string | The prefix to check for. A new Expr representing the 'starts with' comparison. | +| prefix | string | The prefix to check for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.startsWith() +A new `Expression` representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string starts with a given prefix (represented as an expression). ```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -field("fullName").startsWith(field("firstName")); +// Check if the 'name' field starts with "Mr." +field("name").startsWith("Mr."); ``` +## Expression.startsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string starts with a given prefix (represented as an expression). + Signature: ```typescript @@ -3474,25 +3204,30 @@ startsWith(prefix: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| prefix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The prefix expression to check for. A new Expr representing the 'starts with' comparison. | +| prefix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The prefix expression to check for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.stringConcat() +A new `Expression` representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates string expressions together. ```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -field("firstName").stringConcat(constant(" "), field("lastName")); +// Check if the 'fullName' field starts with the value of the 'firstName' field +field("fullName").startsWith(field("firstName")); ``` +## Expression.stringConcat() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates string expressions together. + Signature: ```typescript @@ -3504,25 +3239,30 @@ stringConcat(secondString: Expression | string, ...otherStrings: ArrayExpr representing the concatenated string. | +| otherStrings | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or string literals to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.stringContains() +A new `Expression` representing the concatenated string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains a specified substring. ```typescript -// Check if the 'description' field contains "example". -field("description").stringContains("example"); +// Combine the 'firstName', " ", and 'lastName' fields into a single string +field("firstName").stringConcat(constant(" "), field("lastName")); ``` +## Expression.stringContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains a specified substring. + Signature: ```typescript @@ -3533,25 +3273,30 @@ stringContains(substring: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| substring | string | The substring to search for. A new Expr representing the 'contains' comparison. | +| substring | string | The substring to search for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.stringContains() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains the string represented by another expression. ```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -field("description").stringContains(field("keyword")); +// Check if the 'description' field contains "example". +field("description").stringContains("example"); ``` +## Expression.stringContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains the string represented by another expression. + Signature: ```typescript @@ -3562,25 +3307,29 @@ stringContains(expr: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the substring to search for. A new Expr representing the 'contains' comparison. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the substring to search for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.stringReverse() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string. ```typescript -// Reverse the value of the 'myString' field. -field("myString").stringReverse(); +// Check if the 'description' field contains the value of the 'keyword' field. +field("description").stringContains(field("keyword")); ``` - A new representing the reversed string. + +## Expression.stringReverse() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string. Signature: @@ -3591,6 +3340,17 @@ stringReverse(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. + +### Example + + +```typescript +// Reverse the value of the 'myString' field. +field("myString").stringReverse(); + +``` + ## Expression.substring() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3646,12 +3406,6 @@ substring(position: Expression, length?: Expression): FunctionExpression; Creates an expression that subtracts another expression from this expression. -```typescript -// Subtract the 'discount' field from the 'price' field -field("price").subtract(field("discount")); - -``` - Signature: ```typescript @@ -3662,25 +3416,30 @@ subtract(subtrahend: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| subtrahend | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract from this expression. A new Expr representing the subtraction operation. | +| subtrahend | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract from this expression. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.subtract() +A new `Expression` representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a constant value from this expression. ```typescript -// Subtract 20 from the value of the 'total' field -field("total").subtract(20); +// Subtract the 'discount' field from the 'price' field +field("price").subtract(field("discount")); ``` +## Expression.subtract() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a constant value from this expression. + Signature: ```typescript @@ -3691,11 +3450,22 @@ subtract(subtrahend: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| subtrahend | number | The constant value to subtract. A new Expr representing the subtraction operation. | +| subtrahend | number | The constant value to subtract. | + +Returns: + +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new `Expression` representing the subtraction operation. + +### Example -Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +```typescript +// Subtract 20 from the value of the 'total' field +field("total").subtract(20); + +``` ## Expression.sum() @@ -3704,13 +3474,6 @@ subtract(subtrahend: number): FunctionExpression; Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -field("orderAmount").sum().as("totalRevenue"); - -``` - A new `AggregateFunction` representing the 'sum' aggregation. - Signature: ```typescript @@ -3720,19 +3483,24 @@ sum(): AggregateFunction; [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.timestampAdd() +A new `AggregateFunction` representing the 'sum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to this timestamp expression. ```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -field("timestamp").timestampAdd(field("unit"), field("amount")); +// Calculate the total revenue from a set of orders +field("orderAmount").sum().as("totalRevenue"); ``` +## Expression.timestampAdd() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to this timestamp expression. + Signature: ```typescript @@ -3744,25 +3512,30 @@ timestampAdd(unit: Expression, amount: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | unit | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampAdd() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to this timestamp expression. ```typescript -// Add 1 day to the 'timestamp' field. -field("timestamp").timestampAdd("day", 1); +// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. +field("timestamp").timestampAdd(field("unit"), field("amount")); ``` +## Expression.timestampAdd() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to this timestamp expression. + Signature: ```typescript @@ -3774,25 +3547,30 @@ timestampAdd(unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | Parameter | Type | Description | | --- | --- | --- | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to add (e.g., "day", "hour"). | -| amount | number | The amount of time to add. A new representing the resulting timestamp. | +| amount | number | The amount of time to add. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampSubtract() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from this timestamp expression. ```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -field("timestamp").timestampSubtract(field("unit"), field("amount")); +// Add 1 day to the 'timestamp' field. +field("timestamp").timestampAdd("day", 1); ``` +## Expression.timestampSubtract() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from this timestamp expression. + Signature: ```typescript @@ -3804,25 +3582,30 @@ timestampSubtract(unit: Expression, amount: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | unit | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampSubtract() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from this timestamp expression. ```typescript -// Subtract 1 day from the 'timestamp' field. -field("timestamp").timestampSubtract("day", 1); +// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. +field("timestamp").timestampSubtract(field("unit"), field("amount")); ``` +## Expression.timestampSubtract() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from this timestamp expression. + Signature: ```typescript @@ -3834,25 +3617,29 @@ timestampSubtract(unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'h | Parameter | Type | Description | | --- | --- | --- | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to subtract (e.g., "day", "hour"). | -| amount | number | The amount of time to subtract. A new representing the resulting timestamp. | +| amount | number | The amount of time to subtract. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampToUnixMicros() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to microseconds since epoch. -field("timestamp").timestampToUnixMicros(); +// Subtract 1 day from the 'timestamp' field. +field("timestamp").timestampSubtract("day", 1); ``` - A new representing the number of microseconds since epoch. + +## Expression.timestampToUnixMicros() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). Signature: @@ -3863,19 +3650,23 @@ timestampToUnixMicros(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampToUnixMillis() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of microseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -field("timestamp").timestampToUnixMillis(); +// Convert the 'timestamp' field to microseconds since epoch. +field("timestamp").timestampToUnixMicros(); ``` - A new representing the number of milliseconds since epoch. + +## Expression.timestampToUnixMillis() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). Signature: @@ -3886,19 +3677,23 @@ timestampToUnixMillis(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampToUnixSeconds() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of milliseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to seconds since epoch. -field("timestamp").timestampToUnixSeconds(); +// Convert the 'timestamp' field to milliseconds since epoch. +field("timestamp").timestampToUnixMillis(); ``` - A new representing the number of seconds since epoch. + +## Expression.timestampToUnixSeconds() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). Signature: @@ -3909,6 +3704,17 @@ timestampToUnixSeconds(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of seconds since epoch. + +### Example + + +```typescript +// Convert the 'timestamp' field to seconds since epoch. +field("timestamp").timestampToUnixSeconds(); + +``` + ## Expression.timestampTruncate() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3927,12 +3733,14 @@ timestampTruncate(granularity: TimeGranularity, timezone?: string | Expression): | Parameter | Type | Description | | --- | --- | --- | | granularity | [TimeGranularity](./firestore_lite_pipelines.md#timegranularity) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -3960,12 +3768,14 @@ timestampTruncate(granularity: Expression, timezone?: string | Expression): Func | Parameter | Type | Description | | --- | --- | --- | | granularity | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -3982,13 +3792,6 @@ field('createdAt').timestampTruncate(field('granularity')) Creates an expression that converts a string to lowercase. -```typescript -// Convert the 'name' field to lowercase -field("name").toLower(); - -``` - A new `Expr` representing the lowercase string. - Signature: ```typescript @@ -3998,19 +3801,23 @@ toLower(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.toUpper() +A new `Expression` representing the lowercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string to uppercase. ```typescript -// Convert the 'title' field to uppercase -field("title").toUpper(); +// Convert the 'name' field to lowercase +field("name").toLower(); ``` - A new `Expr` representing the uppercase string. + +## Expression.toUpper() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string to uppercase. Signature: @@ -4021,22 +3828,24 @@ toUpper(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.trim() +A new `Expression` representing the uppercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes leading and trailing characters from a string or byte array. ```typescript -// Trim whitespace from the 'userInput' field -field("userInput").trim(); - -// Trim quotes from the 'userInput' field -field("userInput").trim('"'); +// Convert the 'title' field to uppercase +field("title").toUpper(); ``` +## Expression.trim() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes leading and trailing characters from a string or byte array. + Signature: ```typescript @@ -4047,12 +3856,26 @@ trim(valueToTrim?: string | Expression | Bytes): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| valueToTrim | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| [Bytes](./firestore_lite.bytes.md#bytes_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. A new Expr representing the trimmed string or byte array. | +| valueToTrim | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| [Bytes](./firestore_lite.bytes.md#bytes_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the trimmed string or byte array. + +### Example + + +```typescript +// Trim whitespace from the 'userInput' field +field("userInput").trim(); + +// Trim quotes from the 'userInput' field +field("userInput").trim('"'); + +``` + ## Expression.type() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -4069,6 +3892,8 @@ type(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the data type. + ### Example @@ -4077,7 +3902,6 @@ type(): FunctionExpression; field('title').type() ``` - A new {Expression} representing the data type. ## Expression.unixMicrosToTimestamp() @@ -4086,13 +3910,6 @@ field('title').type() Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -field("microseconds").unixMicrosToTimestamp(); - -``` - A new representing the timestamp. - Signature: ```typescript @@ -4102,19 +3919,23 @@ unixMicrosToTimestamp(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.unixMillisToTimestamp() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -field("milliseconds").unixMillisToTimestamp(); +// Interpret the 'microseconds' field as microseconds since epoch. +field("microseconds").unixMicrosToTimestamp(); ``` - A new representing the timestamp. + +## Expression.unixMillisToTimestamp() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. Signature: @@ -4125,19 +3946,23 @@ unixMillisToTimestamp(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.unixSecondsToTimestamp() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'seconds' field as seconds since epoch. -field("seconds").unixSecondsToTimestamp(); +// Interpret the 'milliseconds' field as milliseconds since epoch. +field("milliseconds").unixMillisToTimestamp(); ``` - A new representing the timestamp. + +## Expression.unixSecondsToTimestamp() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. Signature: @@ -4148,19 +3973,23 @@ unixSecondsToTimestamp(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## Expression.vectorLength() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. ```typescript -// Get the vector length (dimension) of the field 'embedding'. -field("embedding").vectorLength(); +// Interpret the 'seconds' field as seconds since epoch. +field("seconds").unixSecondsToTimestamp(); ``` - A new representing the length of the vector. + +## Expression.vectorLength() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. Signature: @@ -4171,3 +4000,14 @@ vectorLength(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the vector. + +### Example + + +```typescript +// Get the vector length (dimension) of the field 'embedding'. +field("embedding").vectorLength(); + +``` + diff --git a/docs-devsite/firestore_lite_pipelines.field.md b/docs-devsite/firestore_lite_pipelines.field.md index 37ec1ea479..f3b7ad7288 100644 --- a/docs-devsite/firestore_lite_pipelines.field.md +++ b/docs-devsite/firestore_lite_pipelines.field.md @@ -13,21 +13,12 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Represents a reference to a field in a Firestore document, or outputs of a stage. +Represents a reference to a field in a Firestore document, or outputs of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) stage.

Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.

You can create a `Field` instance using the static method: -```typescript -// Create a Field instance for the 'name' field -const nameField = field("name"); - -// Create a Field instance for a nested field 'address.city' -const cityField = field("address.city"); - -``` - Signature: ```typescript @@ -101,3 +92,16 @@ get fieldName(): string; ```typescript selectable: true; ``` + +### Example + + +```typescript +// Create a Field instance for the 'name' field +const nameField = field("name"); + +// Create a Field instance for a nested field 'address.city' +const cityField = field("address.city"); + +``` + diff --git a/docs-devsite/firestore_lite_pipelines.functionexpression.md b/docs-devsite/firestore_lite_pipelines.functionexpression.md index ef3a422c16..22f7670d2e 100644 --- a/docs-devsite/firestore_lite_pipelines.functionexpression.md +++ b/docs-devsite/firestore_lite_pipelines.functionexpression.md @@ -13,9 +13,9 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -This class defines the base class for Firestore functions, which can be evaluated within pipeline execution. +This class defines the base class for Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) functions, which can be evaluated within pipeline execution. -Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_.md#and_e72c712), , or the methods on (, , etc.) to construct new Function instances. +Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_pipelines.md#and_e0c48bd), [equal()](./firestore_pipelines.md#equal_b3c3382), or the methods on [Expression](./firestore_pipelines.expression.md#expression_class) ([Expression.equal()](./firestore_pipelines.expression.md#expressionequal), [Expression.lessThan()](./firestore_pipelines.expression.md#expressionlessthan), etc.) to construct new Function instances. Signature: diff --git a/docs-devsite/firestore_lite_pipelines.md b/docs-devsite/firestore_lite_pipelines.md index 8173c81da6..1f2599ce81 100644 --- a/docs-devsite/firestore_lite_pipelines.md +++ b/docs-devsite/firestore_lite_pipelines.md @@ -16,1618 +16,276 @@ https://github.com/firebase/firebase-js-sdk | Function | Description | | --- | --- | | function() | -| [countAll()](./firestore_lite_pipelines.md#countall) | (Public Preview) Creates an aggregation that counts the total number of stage inputs. -```typescript -// Count the total number of input documents -countAll().as("totalDocument"); - -``` - A new representing the 'countAll' aggregation. | -| [currentTimestamp()](./firestore_lite_pipelines.md#currenttimestamp) | (Public Preview) Creates an expression that evaluates to the current server timestamp. -```typescript -// Get the current server timestamp -currentTimestamp() - -``` - A new Expression representing the current server timestamp. | +| [countAll()](./firestore_lite_pipelines.md#countall) | (Public Preview) Creates an aggregation that counts the total number of stage inputs. | +| [currentTimestamp()](./firestore_lite_pipelines.md#currenttimestamp) | (Public Preview) Creates an expression that evaluates to the current server timestamp. | | function(array, ...) | -| [arrayContains(array, element)](./firestore_lite_pipelines.md#arraycontains_a00ea48) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. -```typescript -// Check if the 'colors' array contains the value of field 'selectedColor' -arrayContains(field("colors"), field("selectedColor")); - -``` - | -| [arrayContains(array, element)](./firestore_lite_pipelines.md#arraycontains_7328608) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. -```typescript -// Check if the 'colors' array contains "red" -arrayContains(field("colors"), "red"); - -``` - | -| [arrayContainsAll(array, values)](./firestore_lite_pipelines.md#arraycontainsall_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. -```typescript -// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" -arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); - -``` - | -| [arrayContainsAll(array, arrayExpression)](./firestore_lite_pipelines.md#arraycontainsall_7b535db) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. -```typescript -// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" -arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); - -``` - | -| [arrayContainsAny(array, values)](./firestore_lite_pipelines.md#arraycontainsany_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. -```typescript -// Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), [field("cate1"), "Science"]); - -``` - | -| [arrayContainsAny(array, values)](./firestore_lite_pipelines.md#arraycontainsany_c381a96) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. -```typescript -// Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), array([field("cate1"), "Science"])); - -``` - | -| [arrayLength(array)](./firestore_lite_pipelines.md#arraylength_195e339) | (Public Preview) Creates an expression that calculates the length of an array expression. -```typescript -// Get the number of items in the 'cart' array -arrayLength(field("cart")); - -``` - | +| [arrayContains(array, element)](./firestore_lite_pipelines.md#arraycontains_a00ea48) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. | +| [arrayContains(array, element)](./firestore_lite_pipelines.md#arraycontains_7328608) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. | +| [arrayContainsAll(array, values)](./firestore_lite_pipelines.md#arraycontainsall_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. | +| [arrayContainsAll(array, arrayExpression)](./firestore_lite_pipelines.md#arraycontainsall_7b535db) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. | +| [arrayContainsAny(array, values)](./firestore_lite_pipelines.md#arraycontainsany_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. | +| [arrayContainsAny(array, values)](./firestore_lite_pipelines.md#arraycontainsany_c381a96) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. | +| [arrayLength(array)](./firestore_lite_pipelines.md#arraylength_195e339) | (Public Preview) Creates an expression that calculates the length of an array expression. | | function(arrayExpression, ...) | -| [arrayGet(arrayExpression, offset)](./firestore_lite_pipelines.md#arrayget_f2e27cc) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet(field('tags'), 1); - -``` - | -| [arrayGet(arrayExpression, offsetExpr)](./firestore_lite_pipelines.md#arrayget_484550d) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet(field('tags'), field('favoriteTag')); - -``` - | -| [join(arrayExpression, delimiterExpression)](./firestore_lite_pipelines.md#join_313e6aa) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join an array of string using the delimiter from the 'separator' field. -join(array(['foo', 'bar']), field("separator")) - -``` - | -| [join(arrayExpression, delimiter)](./firestore_lite_pipelines.md#join_d088d29) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -join(field("tags"), ", ") - -``` - | +| [arrayGet(arrayExpression, offset)](./firestore_lite_pipelines.md#arrayget_f2e27cc) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayGet(arrayExpression, offsetExpr)](./firestore_lite_pipelines.md#arrayget_484550d) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [join(arrayExpression, delimiterExpression)](./firestore_lite_pipelines.md#join_313e6aa) | (Public Preview) Creates an expression that joins the elements of an array into a string. | +| [join(arrayExpression, delimiter)](./firestore_lite_pipelines.md#join_d088d29) | (Public Preview) Creates an expression that joins the elements of an array into a string. | | function(arrayField, ...) | -| [arrayGet(arrayField, offset)](./firestore_lite_pipelines.md#arrayget_3f58471) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet('tags', 1); - -``` - | -| [arrayGet(arrayField, offsetExpr)](./firestore_lite_pipelines.md#arrayget_1904c9a) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet('tags', field('favoriteTag')); - -``` - | +| [arrayGet(arrayField, offset)](./firestore_lite_pipelines.md#arrayget_3f58471) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayGet(arrayField, offsetExpr)](./firestore_lite_pipelines.md#arrayget_1904c9a) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | | function(arrayFieldName, ...) | -| [join(arrayFieldName, delimiter)](./firestore_lite_pipelines.md#join_478ef36) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -join("tags", ", ") - -``` - | -| [join(arrayFieldName, delimiterExpression)](./firestore_lite_pipelines.md#join_829294c) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -join('tags', field("separator")) - -``` - | +| [join(arrayFieldName, delimiter)](./firestore_lite_pipelines.md#join_478ef36) | (Public Preview) Creates an expression that joins the elements of an array into a string. | +| [join(arrayFieldName, delimiterExpression)](./firestore_lite_pipelines.md#join_829294c) | (Public Preview) Creates an expression that joins the elements of an array into a string. | | function(base, ...) | -| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_e4a9e64) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow(field("base"), field("exponent")); - -``` - | -| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_93eae7f) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent. -```typescript -// Raise the value of the 'base' field to the power of 2. -pow(field("base"), 2); - -``` - | -| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_a237721) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow("base", field("exponent")); - -``` - | -| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_f4d7908) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent. -```typescript -// Raise the value of the 'base' field to the power of 2. -pow("base", 2); - -``` - | +| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_e4a9e64) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent expression. | +| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_93eae7f) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent. | +| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_a237721) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent expression. | +| [pow(base, exponent)](./firestore_lite_pipelines.md#pow_f4d7908) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent. | | function(booleanExpr, ...) | -| [countIf(booleanExpr)](./firestore_lite_pipelines.md#countif_c5b8fb1) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true. -```typescript -// Count the number of documents where 'is_active' field equals true -countIf(field("is_active").equal(true)).as("numActiveDocuments"); - -``` - | -| [not(booleanExpr)](./firestore_lite_pipelines.md#not_c5b8fb1) | (Public Preview) Creates an expression that negates a filter condition. -```typescript -// Find documents where the 'completed' field is NOT true -not(equal("completed", true)); - -``` - | +| [countIf(booleanExpr)](./firestore_lite_pipelines.md#countif_c5b8fb1) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true. | +| [not(booleanExpr)](./firestore_lite_pipelines.md#not_c5b8fb1) | (Public Preview) Creates an expression that negates a filter condition. | | function(condition, ...) | -| [conditional(condition, thenExpr, elseExpr)](./firestore_lite_pipelines.md#conditional_07a206d) | (Public Preview) Creates a conditional expression that evaluates to a 'then' expression if a condition is true and an 'else' expression if the condition is false. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -conditional( - greaterThan("age", 18), constant("Adult"), constant("Minor")); - -``` - | +| [conditional(condition, thenExpr, elseExpr)](./firestore_lite_pipelines.md#conditional_07a206d) | (Public Preview) Creates a conditional expression that evaluates to a 'then' expression if a condition is true and an 'else' expression if the condition is false. | | function(documentPath, ...) | -| [documentId(documentPath)](./firestore_lite_pipelines.md#documentid_cef293c) | (Public Preview) Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(myDocumentReference); - -``` - A new representing the documentId operation. | +| [documentId(documentPath)](./firestore_lite_pipelines.md#documentid_cef293c) | (Public Preview) Creates an expression that returns the document ID from a path. | | function(documentPathExpr, ...) | -| [documentId(documentPathExpr)](./firestore_lite_pipelines.md#documentid_9a69021) | (Public Preview) Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(field("__path__")); - -``` - A new representing the documentId operation. | +| [documentId(documentPathExpr)](./firestore_lite_pipelines.md#documentid_9a69021) | (Public Preview) Creates an expression that returns the document ID from a path. | | function(element, ...) | -| [notEqualAny(element, values)](./firestore_lite_pipelines.md#notequalany_c2c5bcb) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -notEqualAny(field("status"), ["pending", field("rejectedStatus")]); - -``` - | -| [notEqualAny(element, arrayExpression)](./firestore_lite_pipelines.md#notequalany_16b2851) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of the field 'rejectedStatus' -notEqualAny(field("status"), ["pending", field("rejectedStatus")]); - -``` - | +| [notEqualAny(element, values)](./firestore_lite_pipelines.md#notequalany_c2c5bcb) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. | +| [notEqualAny(element, arrayExpression)](./firestore_lite_pipelines.md#notequalany_16b2851) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. | | function(elements, ...) | -| [array(elements)](./firestore_lite_pipelines.md#array_7d853aa) | (Public Preview) Creates an expression that creates a Firestore array value from an input array. -```typescript -// Create an array value from the input array and reference the 'baz' field value from the input document. -array(['bar', Field.of('baz')]).as('foo'); - -``` - | -| [map(elements)](./firestore_lite_pipelines.md#map_ce5dee1) | (Public Preview) Creates an expression that creates a Firestore map value from an input object. -```typescript -// Create a map from the input object and reference the 'baz' field value from the input document. -map({foo: 'bar', baz: Field.of('baz')}).as('data'); - -``` - | +| [array(elements)](./firestore_lite_pipelines.md#array_7d853aa) | (Public Preview) Creates an expression that creates a Firestore array value from an input array. | +| [map(elements)](./firestore_lite_pipelines.md#map_ce5dee1) | (Public Preview) Creates an expression that creates a Firestore map value from an input object. | | function(expr, ...) | | [abs(expr)](./firestore_lite_pipelines.md#abs_005f3d4) | (Public Preview) Creates an expression that computes the absolute value of a numeric value. | -| [ascending(expr)](./firestore_lite_pipelines.md#ascending_005f3d4) | (Public Preview) Creates an that sorts documents in ascending order based on an expression. -```typescript -// Sort documents by the 'name' field in lowercase in ascending order -firestore.pipeline().collection("users") - .sort(ascending(field("name").toLower())); - -``` - | -| [byteLength(expr)](./firestore_lite_pipelines.md#bytelength_005f3d4) | (Public Preview) Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. -```typescript -// Calculate the length of the 'myString' field in bytes. -byteLength(field("myString")); - -``` - | +| [ascending(expr)](./firestore_lite_pipelines.md#ascending_005f3d4) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on an expression. | +| [byteLength(expr)](./firestore_lite_pipelines.md#bytelength_005f3d4) | (Public Preview) Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. | | [countDistinct(expr)](./firestore_lite_pipelines.md#countdistinct_3c28b08) | (Public Preview) Creates an aggregation that counts the number of distinct values of a field. | -| [descending(expr)](./firestore_lite_pipelines.md#descending_005f3d4) | (Public Preview) Creates an that sorts documents in descending order based on an expression. -```typescript -// Sort documents by the 'name' field in lowercase in descending order -firestore.pipeline().collection("users") - .sort(descending(field("name").toLower())); - -``` - | +| [descending(expr)](./firestore_lite_pipelines.md#descending_005f3d4) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on an expression. | | [floor(expr)](./firestore_lite_pipelines.md#floor_005f3d4) | (Public Preview) Creates an expression that computes the floor of a numeric value. | -| [timestampToUnixMicros(expr)](./firestore_lite_pipelines.md#timestamptounixmicros_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to microseconds since epoch. -timestampToUnixMicros(field("timestamp")); - -``` - | -| [timestampToUnixMillis(expr)](./firestore_lite_pipelines.md#timestamptounixmillis_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -timestampToUnixMillis(field("timestamp")); - -``` - | -| [timestampToUnixSeconds(expr)](./firestore_lite_pipelines.md#timestamptounixseconds_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to seconds since epoch. -timestampToUnixSeconds(field("timestamp")); - -``` - | -| [unixMicrosToTimestamp(expr)](./firestore_lite_pipelines.md#unixmicrostotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -unixMicrosToTimestamp(field("microseconds")); - -``` - | -| [unixMillisToTimestamp(expr)](./firestore_lite_pipelines.md#unixmillistotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -unixMillisToTimestamp(field("milliseconds")); - -``` - | -| [unixSecondsToTimestamp(expr)](./firestore_lite_pipelines.md#unixsecondstotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'seconds' field as seconds since epoch. -unixSecondsToTimestamp(field("seconds")); - -``` - | +| [timestampToUnixMicros(expr)](./firestore_lite_pipelines.md#timestamptounixmicros_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixMillis(expr)](./firestore_lite_pipelines.md#timestamptounixmillis_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixSeconds(expr)](./firestore_lite_pipelines.md#timestamptounixseconds_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [unixMicrosToTimestamp(expr)](./firestore_lite_pipelines.md#unixmicrostotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixMillisToTimestamp(expr)](./firestore_lite_pipelines.md#unixmillistotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixSecondsToTimestamp(expr)](./firestore_lite_pipelines.md#unixsecondstotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | | function(expression, ...) | -| [arraySum(expression)](./firestore_lite_pipelines.md#arraysum_1138a27) | (Public Preview) Creates an expression that computes the sum of the elements in an array. -```typescript -// Compute the sum of the elements in the 'scores' field. -arraySum(field("scores")); - -``` - | -| [average(expression)](./firestore_lite_pipelines.md#average_1138a27) | (Public Preview) Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. -```typescript -// Calculate the average age of users -average(field("age")).as("averageAge"); - -``` - | -| [ceil(expression)](./firestore_lite_pipelines.md#ceil_1138a27) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. -```typescript -// Compute the ceiling of the 'price' field. -ceil(field("price")); - -``` - | -| [collectionId(expression)](./firestore_lite_pipelines.md#collectionid_1138a27) | (Public Preview) Creates an expression that returns the collection ID from a path. -```typescript -// Get the collection ID from a path. -collectionId(field("__name__")); - -``` - | -| [count(expression)](./firestore_lite_pipelines.md#count_1138a27) | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. -```typescript -// Count the number of items where the price is greater than 10 -count(field("price").greaterThan(10)).as("expensiveItemCount"); - -``` - | -| [divide(expression, value)](./firestore_lite_pipelines.md#divide_01df3cf) | (Public Preview) Creates an expression that divides an expression by a constant value. -```typescript -// Divide the 'value' field by 10 -divide(field("value"), 10); - -``` - | -| [equal(expression, value)](./firestore_lite_pipelines.md#equal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is equal to a constant value. -```typescript -// Check if the 'age' field is equal to 21 -equal(field("age"), 21); - -``` - | -| [equalAny(expression, values)](./firestore_lite_pipelines.md#equalany_7e759b5) | (Public Preview) Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -equalAny(field("category"), [constant("Electronics"), field("primaryType")]); - -``` - | -| [equalAny(expression, arrayExpression)](./firestore_lite_pipelines.md#equalany_214ce68) | (Public Preview) Creates an expression that checks if an expression is equal to any of the provided values. -```typescript -// Check if the 'category' field is set to a value in the disabledCategories field -equalAny(field("category"), field('disabledCategories')); - -``` - | -| [exp(expression)](./firestore_lite_pipelines.md#exp_1138a27) | (Public Preview) Creates an expression that computes e to the power of the expression's result. -```typescript -// Compute e to the power of 2. -exp(constant(2)); - -``` - A new representing the exp of the numeric value. | -| [greaterThan(expression, value)](./firestore_lite_pipelines.md#greaterthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than a constant value. -```typescript -// Check if the 'age' field is greater than 18 -greaterThan(field("age"), 18); - -``` - | -| [greaterThanOrEqual(expression, value)](./firestore_lite_pipelines.md#greaterthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than or equal to a constant value. -```typescript -// Check if the 'quantity' field is greater than or equal to 10 -greaterThanOrEqual(field("quantity"), 10); - -``` - | -| [length\_2(expression)](./firestore_lite_pipelines.md#length_2_1138a27) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. -```typescript -// Get the length of the 'name' field. -length(field("name")); - -// Get the number of items in the 'cart' array. -length(field("cart")); - -``` - | -| [lessThan(expression, value)](./firestore_lite_pipelines.md#lessthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than a constant value. -```typescript -// Check if the 'age' field is less than 30 -lessThan(field("age"), 30); - -``` - | -| [lessThanOrEqual(expression, value)](./firestore_lite_pipelines.md#lessthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than or equal to a constant value. -```typescript -// Check if the 'quantity' field is less than or equal to 20 -lessThan(field("quantity"), 20); - -``` - | -| [ln(expression)](./firestore_lite_pipelines.md#ln_1138a27) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. -```typescript -// Compute the natural logarithm of the 'value' field. -ln(field("value")); - -``` - | -| [log(expression, base)](./firestore_lite_pipelines.md#log_ac183e2) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. -```typescript -// Compute the logarithm of the 'value' field with base 10. -log(field("value"), 10); - -``` - | -| [log(expression, base)](./firestore_lite_pipelines.md#log_1894737) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. -```typescript -// Compute the logarithm of the 'value' field with the base in the 'base' field. -log(field("value"), field("base")); - -``` - | -| [log10(expression)](./firestore_lite_pipelines.md#log10_1138a27) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. -```typescript -// Compute the base-10 logarithm of the 'value' field. -log10(field("value")); - -``` - | -| [maximum(expression)](./firestore_lite_pipelines.md#maximum_1138a27) | (Public Preview) Creates an aggregation that finds the maximum value of an expression across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -maximum(field("score")).as("highestScore"); - -``` - | -| [minimum(expression)](./firestore_lite_pipelines.md#minimum_1138a27) | (Public Preview) Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. -```typescript -// Find the lowest price of all products -minimum(field("price")).as("lowestPrice"); - -``` - | -| [mod(expression, value)](./firestore_lite_pipelines.md#mod_01df3cf) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. -```typescript -// Calculate the remainder of dividing 'field1' by 5. -mod(field("field1"), 5); - -``` - | -| [notEqual(expression, value)](./firestore_lite_pipelines.md#notequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is not equal to a constant value. -```typescript -// Check if the 'status' field is not equal to "completed" -notEqual(field("status"), "completed"); - -``` - | -| [round(expression)](./firestore_lite_pipelines.md#round_1138a27) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. -```typescript -// Round the value of the 'price' field. -round(field("price")); - -``` - | -| [round(expression, decimalPlaces)](./firestore_lite_pipelines.md#round_a3a92d0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -round(field("price"), constant(2)); - -``` - | +| [arraySum(expression)](./firestore_lite_pipelines.md#arraysum_1138a27) | (Public Preview) Creates an expression that computes the sum of the elements in an array. | +| [average(expression)](./firestore_lite_pipelines.md#average_1138a27) | (Public Preview) Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. | +| [ceil(expression)](./firestore_lite_pipelines.md#ceil_1138a27) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. | +| [collectionId(expression)](./firestore_lite_pipelines.md#collectionid_1138a27) | (Public Preview) Creates an expression that returns the collection ID from a path. | +| [count(expression)](./firestore_lite_pipelines.md#count_1138a27) | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. | +| [divide(expression, value)](./firestore_lite_pipelines.md#divide_01df3cf) | (Public Preview) Creates an expression that divides an expression by a constant value. | +| [equal(expression, value)](./firestore_lite_pipelines.md#equal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is equal to a constant value. | +| [equalAny(expression, values)](./firestore_lite_pipelines.md#equalany_7e759b5) | (Public Preview) Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. | +| [equalAny(expression, arrayExpression)](./firestore_lite_pipelines.md#equalany_214ce68) | (Public Preview) Creates an expression that checks if an expression is equal to any of the provided values. | +| [exp(expression)](./firestore_lite_pipelines.md#exp_1138a27) | (Public Preview) Creates an expression that computes e to the power of the expression's result. | +| [greaterThan(expression, value)](./firestore_lite_pipelines.md#greaterthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than a constant value. | +| [greaterThanOrEqual(expression, value)](./firestore_lite_pipelines.md#greaterthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than or equal to a constant value. | +| [length\_2(expression)](./firestore_lite_pipelines.md#length_2_1138a27) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. | +| [lessThan(expression, value)](./firestore_lite_pipelines.md#lessthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than a constant value. | +| [lessThanOrEqual(expression, value)](./firestore_lite_pipelines.md#lessthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than or equal to a constant value. | +| [ln(expression)](./firestore_lite_pipelines.md#ln_1138a27) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. | +| [log(expression, base)](./firestore_lite_pipelines.md#log_ac183e2) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. | +| [log(expression, base)](./firestore_lite_pipelines.md#log_1894737) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. | +| [log10(expression)](./firestore_lite_pipelines.md#log10_1138a27) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. | +| [maximum(expression)](./firestore_lite_pipelines.md#maximum_1138a27) | (Public Preview) Creates an aggregation that finds the maximum value of an expression across multiple stage inputs. | +| [minimum(expression)](./firestore_lite_pipelines.md#minimum_1138a27) | (Public Preview) Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. | +| [mod(expression, value)](./firestore_lite_pipelines.md#mod_01df3cf) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. | +| [notEqual(expression, value)](./firestore_lite_pipelines.md#notequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is not equal to a constant value. | +| [round(expression)](./firestore_lite_pipelines.md#round_1138a27) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. | +| [round(expression, decimalPlaces)](./firestore_lite_pipelines.md#round_a3a92d0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | | [split(expression, delimiter)](./firestore_lite_pipelines.md#split_5b5612b) | (Public Preview) Creates an expression that splits a string into an array of substrings based on the provided delimiter. | | [split(expression, delimiter)](./firestore_lite_pipelines.md#split_5a171ed) | (Public Preview) Creates an expression that splits a string into an array of substrings based on the provided delimiter. | -| [sqrt(expression)](./firestore_lite_pipelines.md#sqrt_1138a27) | (Public Preview) Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt(field("value")); - -``` - | -| [subtract(expression, value)](./firestore_lite_pipelines.md#subtract_01df3cf) | (Public Preview) Creates an expression that subtracts a constant value from an expression. -```typescript -// Subtract the constant value 2 from the 'value' field -subtract(field("value"), 2); - -``` - | -| [sum(expression)](./firestore_lite_pipelines.md#sum_1138a27) | (Public Preview) Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -sum(field("orderAmount")).as("totalRevenue"); - -``` - | +| [sqrt(expression)](./firestore_lite_pipelines.md#sqrt_1138a27) | (Public Preview) Creates an expression that computes the square root of a numeric value. | +| [subtract(expression, value)](./firestore_lite_pipelines.md#subtract_01df3cf) | (Public Preview) Creates an expression that subtracts a constant value from an expression. | +| [sum(expression)](./firestore_lite_pipelines.md#sum_1138a27) | (Public Preview) Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. | | [type(expression)](./firestore_lite_pipelines.md#type_1138a27) | (Public Preview) Creates an expression that returns the data type of an expression's result. | | function(field, ...) | -| [isAbsent(field)](./firestore_lite_pipelines.md#isabsent_0fb8cd4) | (Public Preview) Creates an expression that returns true if a field is absent. Otherwise, returns false even if the field value is null. -```typescript -// Check if the field `value` is absent. -isAbsent("value"); - -``` - | -| [reverse(field)](./firestore_lite_pipelines.md#reverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. -```typescript -// Reverse the value of the 'myString' field. -reverse("myString"); - -``` - | -| [stringReverse(field)](./firestore_lite_pipelines.md#stringreverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. -```typescript -// Reverse the value of the 'myString' field. -strReverse("myString"); - -``` - | +| [isAbsent(field)](./firestore_lite_pipelines.md#isabsent_0fb8cd4) | (Public Preview) Creates an expression that returns true if a field is absent. Otherwise, returns false even if the field value is null. | +| [reverse(field)](./firestore_lite_pipelines.md#reverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. | +| [stringReverse(field)](./firestore_lite_pipelines.md#stringreverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. | | [substring(field, position, length)](./firestore_lite_pipelines.md#substring_0d9573a) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | | [substring(field, position, length)](./firestore_lite_pipelines.md#substring_05cb14e) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | | function(fieldName, ...) | | [abs(fieldName)](./firestore_lite_pipelines.md#abs_e5b0480) | (Public Preview) Creates an expression that computes the absolute value of a numeric value. | -| [add(fieldName, second)](./firestore_lite_pipelines.md#add_b75bb8b) | (Public Preview) Creates an expression that adds a field's value to an expression. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -add("quantity", field("reserve")); - -``` - | -| [arrayContains(fieldName, element)](./firestore_lite_pipelines.md#arraycontains_aaace4a) | (Public Preview) Creates an expression that checks if a field's array value contains a specific element. -```typescript -// Check if the 'colors' array contains the value of field 'selectedColor' -arrayContains("colors", field("selectedColor")); - -``` - | -| [arrayContains(fieldName, element)](./firestore_lite_pipelines.md#arraycontains_999590f) | (Public Preview) Creates an expression that checks if a field's array value contains a specific value. -```typescript -// Check if the 'colors' array contains "red" -arrayContains("colors", "red"); - -``` - | -| [arrayContainsAll(fieldName, values)](./firestore_lite_pipelines.md#arraycontainsall_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. -```typescript -// Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" -arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); - -``` - | -| [arrayContainsAll(fieldName, arrayExpression)](./firestore_lite_pipelines.md#arraycontainsall_48da8d9) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. -```typescript -// Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" -arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); - -``` - | -| [arrayContainsAny(fieldName, values)](./firestore_lite_pipelines.md#arraycontainsany_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. -```typescript -// Check if the 'groups' array contains either the value from the 'userGroup' field -// or the value "guest" -arrayContainsAny("categories", [field("cate1"), "Science"]); - -``` - | -| [arrayContainsAny(fieldName, values)](./firestore_lite_pipelines.md#arraycontainsany_1b4f7cd) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. -```typescript -// Check if the 'groups' array contains either the value from the 'userGroup' field -// or the value "guest" -arrayContainsAny("categories", array([field("cate1"), "Science"])); - -``` - | -| [arrayLength(fieldName)](./firestore_lite_pipelines.md#arraylength_e5b0480) | (Public Preview) Creates an expression that calculates the length of an array in a specified field. -```typescript -// Get the number of items in field 'cart' -arrayLength('cart'); - -``` - | -| [arraySum(fieldName)](./firestore_lite_pipelines.md#arraysum_e5b0480) | (Public Preview) Creates an expression that computes the sum of the elements in an array. -```typescript -// Compute the sum of the elements in the 'scores' field. -arraySum("scores"); - -``` - | -| [ascending(fieldName)](./firestore_lite_pipelines.md#ascending_e5b0480) | (Public Preview) Creates an that sorts documents in ascending order based on a field. -```typescript -// Sort documents by the 'name' field in ascending order -firestore.pipeline().collection("users") - .sort(ascending("name")); - -``` - | -| [average(fieldName)](./firestore_lite_pipelines.md#average_e5b0480) | (Public Preview) Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. -```typescript -// Calculate the average age of users -average("age").as("averageAge"); - -``` - | -| [byteLength(fieldName)](./firestore_lite_pipelines.md#bytelength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. -```typescript -// Calculate the length of the 'myString' field in bytes. -byteLength("myString"); - -``` - | -| [ceil(fieldName)](./firestore_lite_pipelines.md#ceil_e5b0480) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. -```typescript -// Compute the ceiling of the 'price' field. -ceil("price"); - -``` - | -| [charLength(fieldName)](./firestore_lite_pipelines.md#charlength_e5b0480) | (Public Preview) Creates an expression that calculates the character length of a string field in UTF8. -```typescript -// Get the character length of the 'name' field in UTF-8. -strLength("name"); - -``` - | -| [collectionId(fieldName)](./firestore_lite_pipelines.md#collectionid_e5b0480) | (Public Preview) Creates an expression that returns the collection ID from a path. -```typescript -// Get the collection ID from a path. -collectionId("__name__"); - -``` - | -| [concat(fieldName, second, others)](./firestore_lite_pipelines.md#concat_828272e) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. -```typescript -// Concatenate a field with a literal string. -concat(field("firstName"), "Doe") - -``` - | -| [cosineDistance(fieldName, vector)](./firestore_lite_pipelines.md#cosinedistance_463a23e) | (Public Preview) Calculates the Cosine distance between a field's vector value and a literal vector value. -```typescript -// Calculate the Cosine distance between the 'location' field and a target location -cosineDistance("location", [37.7749, -122.4194]); - -``` - | -| [cosineDistance(fieldName, vectorExpression)](./firestore_lite_pipelines.md#cosinedistance_ed766a1) | (Public Preview) Calculates the Cosine distance between a field's vector value and a vector expression. -```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -cosineDistance("userVector", field("itemVector")); - -``` - | -| [count(fieldName)](./firestore_lite_pipelines.md#count_e5b0480) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the input field exists. -```typescript -// Count the total number of products -count("productId").as("totalProducts"); - -``` - | -| [descending(fieldName)](./firestore_lite_pipelines.md#descending_e5b0480) | (Public Preview) Creates an that sorts documents in descending order based on a field. -```typescript -// Sort documents by the 'name' field in descending order -firestore.pipeline().collection("users") - .sort(descending("name")); - -``` - | -| [divide(fieldName, expressions)](./firestore_lite_pipelines.md#divide_cf36e43) | (Public Preview) Creates an expression that divides a field's value by an expression. -```typescript -// Divide the 'total' field by the 'count' field -divide("total", field("count")); - -``` - | -| [divide(fieldName, value)](./firestore_lite_pipelines.md#divide_65e2f32) | (Public Preview) Creates an expression that divides a field's value by a constant value. -```typescript -// Divide the 'value' field by 10 -divide("value", 10); - -``` - | -| [dotProduct(fieldName, vector)](./firestore_lite_pipelines.md#dotproduct_463a23e) | (Public Preview) Calculates the dot product between a field's vector value and a double array. -```typescript -// Calculate the dot product distance between a feature vector and a target vector -dotProduct("features", [0.5, 0.8, 0.2]); - -``` - | -| [dotProduct(fieldName, vectorExpression)](./firestore_lite_pipelines.md#dotproduct_ed766a1) | (Public Preview) Calculates the dot product between a field's vector value and a vector expression. -```typescript -// Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2' -dotProduct("docVector1", field("docVector2")); - -``` - | -| [endsWith(fieldName, suffix)](./firestore_lite_pipelines.md#endswith_05ca3b0) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. -```typescript -// Check if the 'filename' field ends with ".txt" -endsWith("filename", ".txt"); - -``` - | -| [endsWith(fieldName, suffix)](./firestore_lite_pipelines.md#endswith_8fc0ebc) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. -```typescript -// Check if the 'url' field ends with the value of the 'extension' field -endsWith("url", field("extension")); - -``` - | -| [equal(fieldName, expression)](./firestore_lite_pipelines.md#equal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is equal to an expression. -```typescript -// Check if the 'age' field is equal to the 'limit' field -equal("age", field("limit")); - -``` - | -| [equal(fieldName, value)](./firestore_lite_pipelines.md#equal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is equal to a constant value. -```typescript -// Check if the 'city' field is equal to string constant "London" -equal("city", "London"); - -``` - | -| [equalAny(fieldName, values)](./firestore_lite_pipelines.md#equalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -equalAny("category", [constant("Electronics"), field("primaryType")]); - -``` - | -| [equalAny(fieldName, arrayExpression)](./firestore_lite_pipelines.md#equalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -equalAny("category", ["Electronics", field("primaryType")]); - -``` - | -| [euclideanDistance(fieldName, vector)](./firestore_lite_pipelines.md#euclideandistance_463a23e) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a double array. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location -euclideanDistance("location", [37.7749, -122.4194]); - -``` - | -| [euclideanDistance(fieldName, vectorExpression)](./firestore_lite_pipelines.md#euclideandistance_ed766a1) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a vector expression. -```typescript -// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' -euclideanDistance("pointA", field("pointB")); - -``` - | -| [exists(fieldName)](./firestore_lite_pipelines.md#exists_e5b0480) | (Public Preview) Creates an expression that checks if a field exists. -```typescript -// Check if the document has a field named "phoneNumber" -exists("phoneNumber"); - -``` - | -| [exp(fieldName)](./firestore_lite_pipelines.md#exp_e5b0480) | (Public Preview) Creates an expression that computes e to the power of the expression's result. -```typescript -// Compute e to the power of the 'value' field. -exp('value'); - -``` - A new representing the exp of the numeric value. | +| [add(fieldName, second)](./firestore_lite_pipelines.md#add_b75bb8b) | (Public Preview) Creates an expression that adds a field's value to an expression. | +| [arrayContains(fieldName, element)](./firestore_lite_pipelines.md#arraycontains_aaace4a) | (Public Preview) Creates an expression that checks if a field's array value contains a specific element. | +| [arrayContains(fieldName, element)](./firestore_lite_pipelines.md#arraycontains_999590f) | (Public Preview) Creates an expression that checks if a field's array value contains a specific value. | +| [arrayContainsAll(fieldName, values)](./firestore_lite_pipelines.md#arraycontainsall_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. | +| [arrayContainsAll(fieldName, arrayExpression)](./firestore_lite_pipelines.md#arraycontainsall_48da8d9) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. | +| [arrayContainsAny(fieldName, values)](./firestore_lite_pipelines.md#arraycontainsany_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. | +| [arrayContainsAny(fieldName, values)](./firestore_lite_pipelines.md#arraycontainsany_1b4f7cd) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. | +| [arrayLength(fieldName)](./firestore_lite_pipelines.md#arraylength_e5b0480) | (Public Preview) Creates an expression that calculates the length of an array in a specified field. | +| [arraySum(fieldName)](./firestore_lite_pipelines.md#arraysum_e5b0480) | (Public Preview) Creates an expression that computes the sum of the elements in an array. | +| [ascending(fieldName)](./firestore_lite_pipelines.md#ascending_e5b0480) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on a field. | +| [average(fieldName)](./firestore_lite_pipelines.md#average_e5b0480) | (Public Preview) Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. | +| [byteLength(fieldName)](./firestore_lite_pipelines.md#bytelength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. | +| [ceil(fieldName)](./firestore_lite_pipelines.md#ceil_e5b0480) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. | +| [charLength(fieldName)](./firestore_lite_pipelines.md#charlength_e5b0480) | (Public Preview) Creates an expression that calculates the character length of a string field in UTF8. | +| [collectionId(fieldName)](./firestore_lite_pipelines.md#collectionid_e5b0480) | (Public Preview) Creates an expression that returns the collection ID from a path. | +| [concat(fieldName, second, others)](./firestore_lite_pipelines.md#concat_828272e) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. | +| [cosineDistance(fieldName, vector)](./firestore_lite_pipelines.md#cosinedistance_463a23e) | (Public Preview) Calculates the Cosine distance between a field's vector value and a literal vector value. | +| [cosineDistance(fieldName, vectorExpression)](./firestore_lite_pipelines.md#cosinedistance_ed766a1) | (Public Preview) Calculates the Cosine distance between a field's vector value and a vector expression. | +| [count(fieldName)](./firestore_lite_pipelines.md#count_e5b0480) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the input field exists. | +| [descending(fieldName)](./firestore_lite_pipelines.md#descending_e5b0480) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on a field. | +| [divide(fieldName, expressions)](./firestore_lite_pipelines.md#divide_cf36e43) | (Public Preview) Creates an expression that divides a field's value by an expression. | +| [divide(fieldName, value)](./firestore_lite_pipelines.md#divide_65e2f32) | (Public Preview) Creates an expression that divides a field's value by a constant value. | +| [dotProduct(fieldName, vector)](./firestore_lite_pipelines.md#dotproduct_463a23e) | (Public Preview) Calculates the dot product between a field's vector value and a double array. | +| [dotProduct(fieldName, vectorExpression)](./firestore_lite_pipelines.md#dotproduct_ed766a1) | (Public Preview) Calculates the dot product between a field's vector value and a vector expression. | +| [endsWith(fieldName, suffix)](./firestore_lite_pipelines.md#endswith_05ca3b0) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. | +| [endsWith(fieldName, suffix)](./firestore_lite_pipelines.md#endswith_8fc0ebc) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. | +| [equal(fieldName, expression)](./firestore_lite_pipelines.md#equal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is equal to an expression. | +| [equal(fieldName, value)](./firestore_lite_pipelines.md#equal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is equal to a constant value. | +| [equalAny(fieldName, values)](./firestore_lite_pipelines.md#equalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. | +| [equalAny(fieldName, arrayExpression)](./firestore_lite_pipelines.md#equalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. | +| [euclideanDistance(fieldName, vector)](./firestore_lite_pipelines.md#euclideandistance_463a23e) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a double array. | +| [euclideanDistance(fieldName, vectorExpression)](./firestore_lite_pipelines.md#euclideandistance_ed766a1) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a vector expression. | +| [exists(fieldName)](./firestore_lite_pipelines.md#exists_e5b0480) | (Public Preview) Creates an expression that checks if a field exists. | +| [exp(fieldName)](./firestore_lite_pipelines.md#exp_e5b0480) | (Public Preview) Creates an expression that computes e to the power of the expression's result. | | [floor(fieldName)](./firestore_lite_pipelines.md#floor_e5b0480) | (Public Preview) Creates an expression that computes the floor of a numeric value. | -| [greaterThan(fieldName, expression)](./firestore_lite_pipelines.md#greaterthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is greater than an expression. -```typescript -// Check if the value of field 'age' is greater than the value of field 'limit' -greaterThan("age", field("limit")); - -``` - | -| [greaterThan(fieldName, value)](./firestore_lite_pipelines.md#greaterthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than a constant value. -```typescript -// Check if the 'price' field is greater than 100 -greaterThan("price", 100); - -``` - | -| [greaterThanOrEqual(fieldName, value)](./firestore_lite_pipelines.md#greaterthanorequal_2e16acb) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to an expression. -```typescript -// Check if the value of field 'age' is greater than or equal to the value of field 'limit' -greaterThanOrEqual("age", field("limit")); - -``` - | -| [greaterThanOrEqual(fieldName, value)](./firestore_lite_pipelines.md#greaterthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to a constant value. -```typescript -// Check if the 'score' field is greater than or equal to 80 -greaterThanOrEqual("score", 80); - -``` - | -| [length\_2(fieldName)](./firestore_lite_pipelines.md#length_2_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. -```typescript -// Get the length of the 'name' field. -length("name"); - -// Get the number of items in the 'cart' array. -length("cart"); - -``` - | -| [lessThan(fieldName, expression)](./firestore_lite_pipelines.md#lessthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than an expression. -```typescript -// Check if the 'age' field is less than the 'limit' field -lessThan("age", field("limit")); - -``` - | -| [lessThan(fieldName, value)](./firestore_lite_pipelines.md#lessthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than a constant value. -```typescript -// Check if the 'price' field is less than 50 -lessThan("price", 50); - -``` - | -| [lessThanOrEqual(fieldName, expression)](./firestore_lite_pipelines.md#lessthanorequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to an expression. -```typescript -// Check if the 'quantity' field is less than or equal to the 'limit' field -lessThan("quantity", field("limit")); - -``` - | -| [lessThanOrEqual(fieldName, value)](./firestore_lite_pipelines.md#lessthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to a constant value. -```typescript -// Check if the 'score' field is less than or equal to 70 -lessThan("score", 70); - -``` - | -| [like(fieldName, pattern)](./firestore_lite_pipelines.md#like_67f7432) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. -```typescript -// Check if the 'title' field contains the string "guide" -like("title", "%guide%"); - -``` - | -| [like(fieldName, pattern)](./firestore_lite_pipelines.md#like_cb1318d) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. -```typescript -// Check if the 'title' field contains the string "guide" -like("title", field("pattern")); - -``` - | -| [ln(fieldName)](./firestore_lite_pipelines.md#ln_e5b0480) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. -```typescript -// Compute the natural logarithm of the 'value' field. -ln("value"); - -``` - | -| [log(fieldName, base)](./firestore_lite_pipelines.md#log_a89e21b) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. -```typescript -// Compute the logarithm of the 'value' field with base 10. -log("value", 10); - -``` - | -| [log(fieldName, base)](./firestore_lite_pipelines.md#log_805b11f) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. -```typescript -// Compute the logarithm of the 'value' field with the base in the 'base' field. -log("value", field("base")); - -``` - | -| [log10(fieldName)](./firestore_lite_pipelines.md#log10_e5b0480) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. -```typescript -// Compute the base-10 logarithm of the 'value' field. -log10("value"); - -``` - | -| [logicalMaximum(fieldName, second, others)](./firestore_lite_pipelines.md#logicalmaximum_828272e) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. -```typescript -// Returns the largest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMaximum("field1", field("field2"), 1000); - -``` - | -| [logicalMinimum(fieldName, second, others)](./firestore_lite_pipelines.md#logicalminimum_828272e) | (Public Preview) Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. -```typescript -// Returns the smallest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMinimum("field1", field("field2"), 1000); - -``` - | -| [mapGet(fieldName, subField)](./firestore_lite_pipelines.md#mapget_06663cf) | (Public Preview) Accesses a value from a map (object) field using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -mapGet("address", "city"); - -``` - | -| [maximum(fieldName)](./firestore_lite_pipelines.md#maximum_e5b0480) | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -maximum("score").as("highestScore"); - -``` - | -| [minimum(fieldName)](./firestore_lite_pipelines.md#minimum_e5b0480) | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. -```typescript -// Find the lowest price of all products -minimum("price").as("lowestPrice"); - -``` - | -| [mod(fieldName, expression)](./firestore_lite_pipelines.md#mod_1e91657) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. -```typescript -// Calculate the remainder of dividing 'field1' by 'field2'. -mod("field1", field("field2")); - -``` - | -| [mod(fieldName, value)](./firestore_lite_pipelines.md#mod_65e2f32) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. -```typescript -// Calculate the remainder of dividing 'field1' by 5. -mod("field1", 5); - -``` - | -| [multiply(fieldName, second)](./firestore_lite_pipelines.md#multiply_b75bb8b) | (Public Preview) Creates an expression that multiplies a field's value by an expression. -```typescript -// Multiply the 'quantity' field by the 'price' field -multiply("quantity", field("price")); - -``` - | -| [notEqual(fieldName, expression)](./firestore_lite_pipelines.md#notequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is not equal to an expression. -```typescript -// Check if the 'status' field is not equal to the value of 'expectedStatus' -notEqual("status", field("expectedStatus")); - -``` - | -| [notEqual(fieldName, value)](./firestore_lite_pipelines.md#notequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is not equal to a constant value. -```typescript -// Check if the 'country' field is not equal to "USA" -notEqual("country", "USA"); - -``` - | -| [notEqualAny(fieldName, values)](./firestore_lite_pipelines.md#notequalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -notEqualAny("status", [constant("pending"), field("rejectedStatus")]); - -``` - | -| [notEqualAny(fieldName, arrayExpression)](./firestore_lite_pipelines.md#notequalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. -```typescript -// Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' -notEqualAny("status", field("rejectedStatuses")); - -``` - | -| [regexContains(fieldName, pattern)](./firestore_lite_pipelines.md#regexcontains_67f7432) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains("description", "(?i)example"); - -``` - | -| [regexContains(fieldName, pattern)](./firestore_lite_pipelines.md#regexcontains_cb1318d) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains("description", field("pattern")); - -``` - | -| [regexMatch(fieldName, pattern)](./firestore_lite_pipelines.md#regexmatch_67f7432) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch("email", "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); - -``` - | -| [regexMatch(fieldName, pattern)](./firestore_lite_pipelines.md#regexmatch_cb1318d) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch("email", field("pattern")); - -``` - | -| [round(fieldName)](./firestore_lite_pipelines.md#round_e5b0480) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. -```typescript -// Round the value of the 'price' field. -round("price"); - -``` - | -| [round(fieldName, decimalPlaces)](./firestore_lite_pipelines.md#round_07d0cf0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -round("price", 2); - -``` - | +| [greaterThan(fieldName, expression)](./firestore_lite_pipelines.md#greaterthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is greater than an expression. | +| [greaterThan(fieldName, value)](./firestore_lite_pipelines.md#greaterthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than a constant value. | +| [greaterThanOrEqual(fieldName, value)](./firestore_lite_pipelines.md#greaterthanorequal_2e16acb) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to an expression. | +| [greaterThanOrEqual(fieldName, value)](./firestore_lite_pipelines.md#greaterthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to a constant value. | +| [length\_2(fieldName)](./firestore_lite_pipelines.md#length_2_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. | +| [lessThan(fieldName, expression)](./firestore_lite_pipelines.md#lessthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than an expression. | +| [lessThan(fieldName, value)](./firestore_lite_pipelines.md#lessthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than a constant value. | +| [lessThanOrEqual(fieldName, expression)](./firestore_lite_pipelines.md#lessthanorequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to an expression. | +| [lessThanOrEqual(fieldName, value)](./firestore_lite_pipelines.md#lessthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to a constant value. | +| [like(fieldName, pattern)](./firestore_lite_pipelines.md#like_67f7432) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. | +| [like(fieldName, pattern)](./firestore_lite_pipelines.md#like_cb1318d) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. | +| [ln(fieldName)](./firestore_lite_pipelines.md#ln_e5b0480) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. | +| [log(fieldName, base)](./firestore_lite_pipelines.md#log_a89e21b) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. | +| [log(fieldName, base)](./firestore_lite_pipelines.md#log_805b11f) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. | +| [log10(fieldName)](./firestore_lite_pipelines.md#log10_e5b0480) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. | +| [logicalMaximum(fieldName, second, others)](./firestore_lite_pipelines.md#logicalmaximum_828272e) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. | +| [logicalMinimum(fieldName, second, others)](./firestore_lite_pipelines.md#logicalminimum_828272e) | (Public Preview) Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. | +| [mapGet(fieldName, subField)](./firestore_lite_pipelines.md#mapget_06663cf) | (Public Preview) Accesses a value from a map (object) field using the provided key. | +| [maximum(fieldName)](./firestore_lite_pipelines.md#maximum_e5b0480) | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. | +| [minimum(fieldName)](./firestore_lite_pipelines.md#minimum_e5b0480) | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. | +| [mod(fieldName, expression)](./firestore_lite_pipelines.md#mod_1e91657) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. | +| [mod(fieldName, value)](./firestore_lite_pipelines.md#mod_65e2f32) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. | +| [multiply(fieldName, second)](./firestore_lite_pipelines.md#multiply_b75bb8b) | (Public Preview) Creates an expression that multiplies a field's value by an expression. | +| [notEqual(fieldName, expression)](./firestore_lite_pipelines.md#notequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is not equal to an expression. | +| [notEqual(fieldName, value)](./firestore_lite_pipelines.md#notequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is not equal to a constant value. | +| [notEqualAny(fieldName, values)](./firestore_lite_pipelines.md#notequalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. | +| [notEqualAny(fieldName, arrayExpression)](./firestore_lite_pipelines.md#notequalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. | +| [regexContains(fieldName, pattern)](./firestore_lite_pipelines.md#regexcontains_67f7432) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. | +| [regexContains(fieldName, pattern)](./firestore_lite_pipelines.md#regexcontains_cb1318d) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. | +| [regexMatch(fieldName, pattern)](./firestore_lite_pipelines.md#regexmatch_67f7432) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. | +| [regexMatch(fieldName, pattern)](./firestore_lite_pipelines.md#regexmatch_cb1318d) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. | +| [round(fieldName)](./firestore_lite_pipelines.md#round_e5b0480) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. | +| [round(fieldName, decimalPlaces)](./firestore_lite_pipelines.md#round_07d0cf0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | | [split(fieldName, delimiter)](./firestore_lite_pipelines.md#split_2cfdd37) | (Public Preview) Creates an expression that splits the value of a field on the provided delimiter. | -| [split(fieldName, delimiter)](./firestore_lite_pipelines.md#split_f4fe06a) | (Public Preview) Creates an expression that splits the value of a field on the provided delimiter. | -| [sqrt(fieldName)](./firestore_lite_pipelines.md#sqrt_e5b0480) | (Public Preview) Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt("value"); - -``` - | -| [startsWith(fieldName, prefix)](./firestore_lite_pipelines.md#startswith_89325cc) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. -```typescript -// Check if the 'name' field starts with "Mr." -startsWith("name", "Mr."); - -``` - | -| [startsWith(fieldName, prefix)](./firestore_lite_pipelines.md#startswith_266c338) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. -```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -startsWith("fullName", field("firstName")); - -``` - | -| [stringConcat(fieldName, secondString, otherStrings)](./firestore_lite_pipelines.md#stringconcat_d80077e) | (Public Preview) Creates an expression that concatenates string functions, fields or constants together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat("firstName", " ", field("lastName")); - -``` - | -| [stringContains(fieldName, substring)](./firestore_lite_pipelines.md#stringcontains_5b94cfe) | (Public Preview) Creates an expression that checks if a string field contains a specified substring. -```typescript -// Check if the 'description' field contains "example". -stringContains("description", "example"); - -``` - | -| [stringContains(fieldName, substring)](./firestore_lite_pipelines.md#stringcontains_ac3ba47) | (Public Preview) Creates an expression that checks if a string field contains a substring specified by an expression. -```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -stringContains("description", field("keyword")); - -``` - | -| [subtract(fieldName, expression)](./firestore_lite_pipelines.md#subtract_1e91657) | (Public Preview) Creates an expression that subtracts an expression from a field's value. -```typescript -// Subtract the 'discount' field from the 'price' field -subtract("price", field("discount")); - -``` - | -| [subtract(fieldName, value)](./firestore_lite_pipelines.md#subtract_65e2f32) | (Public Preview) Creates an expression that subtracts a constant value from a field's value. -```typescript -// Subtract 20 from the value of the 'total' field -subtract("total", 20); - -``` - | -| [sum(fieldName)](./firestore_lite_pipelines.md#sum_e5b0480) | (Public Preview) Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -sum("orderAmount").as("totalRevenue"); - -``` - | -| [timestampAdd(fieldName, unit, amount)](./firestore_lite_pipelines.md#timestampadd_341fe7d) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp represented by a field. -```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd("timestamp", "day", 1); - -``` - | -| [timestampSubtract(fieldName, unit, amount)](./firestore_lite_pipelines.md#timestampsubtract_341fe7d) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. -```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract("timestamp", "day", 1); - -``` - | -| [timestampToUnixMicros(fieldName)](./firestore_lite_pipelines.md#timestamptounixmicros_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to microseconds since epoch. -timestampToUnixMicros("timestamp"); - -``` - | -| [timestampToUnixMillis(fieldName)](./firestore_lite_pipelines.md#timestamptounixmillis_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -timestampToUnixMillis("timestamp"); - -``` - | -| [timestampToUnixSeconds(fieldName)](./firestore_lite_pipelines.md#timestamptounixseconds_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to seconds since epoch. -timestampToUnixSeconds("timestamp"); - -``` - | -| [timestampTruncate(fieldName, granularity, timezone)](./firestore_lite_pipelines.md#timestamptruncate_b6c7512) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | -| [timestampTruncate(fieldName, granularity, timezone)](./firestore_lite_pipelines.md#timestamptruncate_ed83d46) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | -| [toLower(fieldName)](./firestore_lite_pipelines.md#tolower_e5b0480) | (Public Preview) Creates an expression that converts a string field to lowercase. -```typescript -// Convert the 'name' field to lowercase -toLower("name"); - -``` - | -| [toUpper(fieldName)](./firestore_lite_pipelines.md#toupper_e5b0480) | (Public Preview) Creates an expression that converts a string field to uppercase. -```typescript -// Convert the 'title' field to uppercase -toUpper("title"); - -``` - | -| [trim(fieldName, valueToTrim)](./firestore_lite_pipelines.md#trim_c9f90ee) | (Public Preview) Creates an expression that removes leading and trailing whitespace from a string or byte array. -```typescript -// Trim whitespace from the 'userInput' field -trim("userInput"); - -// Trim quotes from the 'userInput' field -trim("userInput", '"'); - -``` - | -| [type(fieldName)](./firestore_lite_pipelines.md#type_e5b0480) | (Public Preview) Creates an expression that returns the data type of the data in the specified field. | -| [unixMicrosToTimestamp(fieldName)](./firestore_lite_pipelines.md#unixmicrostotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -unixMicrosToTimestamp("microseconds"); - -``` - | -| [unixMillisToTimestamp(fieldName)](./firestore_lite_pipelines.md#unixmillistotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -unixMillisToTimestamp("milliseconds"); - -``` - | -| [unixSecondsToTimestamp(fieldName)](./firestore_lite_pipelines.md#unixsecondstotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'seconds' field as seconds since epoch. -unixSecondsToTimestamp("seconds"); - -``` - | -| [vectorLength(fieldName)](./firestore_lite_pipelines.md#vectorlength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector represented by a field. -```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength("embedding"); - -``` - | -| function(first, ...) | -| [add(first, second)](./firestore_lite_pipelines.md#add_846ca1b) | (Public Preview) Creates an expression that adds two expressions together. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -add(field("quantity"), field("reserve")); - -``` - | -| [and(first, second, more)](./firestore_lite_pipelines.md#and_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'AND' operation on multiple filter conditions. -```typescript -// Check if the 'age' field is greater than 18 AND the 'city' field is "London" AND -// the 'status' field is "active" -const condition = and(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); - -``` - | -| [concat(first, second, others)](./firestore_lite_pipelines.md#concat_83be015) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. -```typescript -// Concatenate the 'firstName' and 'lastName' fields with a space in between. -concat(field("firstName"), " ", field("lastName")) - -``` - | -| [logicalMaximum(first, second, others)](./firestore_lite_pipelines.md#logicalmaximum_83be015) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. -```typescript -// Returns the largest value between the 'field1' field, the 'field2' field, -// and 1000 -logicalMaximum(field("field1"), field("field2"), 1000); - -``` - | -| [logicalMinimum(first, second, others)](./firestore_lite_pipelines.md#logicalminimum_83be015) | (Public Preview) Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. -```typescript -// Returns the smallest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMinimum(field("field1"), field("field2"), 1000); - -``` - | -| [multiply(first, second)](./firestore_lite_pipelines.md#multiply_846ca1b) | (Public Preview) Creates an expression that multiplies two expressions together. -```typescript -// Multiply the 'quantity' field by the 'price' field -multiply(field("quantity"), field("price")); - -``` - | -| [or(first, second, more)](./firestore_lite_pipelines.md#or_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'OR' operation on multiple filter conditions. -```typescript -// Check if the 'age' field is greater than 18 OR the 'city' field is "London" OR -// the 'status' field is "active" -const condition = or(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); - -``` - | -| [xor(first, second, additionalConditions)](./firestore_lite_pipelines.md#xor_8197113) | (Public Preview) Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. -```typescript -// Check if only one of the conditions is true: 'age' greater than 18, 'city' is "London", -// or 'status' is "active". -const condition = xor( - greaterThan("age", 18), - equal("city", "London"), - equal("status", "active")); - -``` - | -| function(firstArray, ...) | -| [arrayConcat(firstArray, secondArray, otherArrays)](./firestore_lite_pipelines.md#arrayconcat_c00d5d7) | (Public Preview) Creates an expression that concatenates an array expression with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat(field("items"), [field("newItems"), field("otherItems")]); - -``` - | -| function(firstArrayField, ...) | -| [arrayConcat(firstArrayField, secondArray, otherArrays)](./firestore_lite_pipelines.md#arrayconcat_f92063d) | (Public Preview) Creates an expression that concatenates a field's array value with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat("items", [field("newItems"), field("otherItems")]); - -``` - | -| function(firstMap, ...) | -| [mapMerge(firstMap, secondMap, otherMaps)](./firestore_lite_pipelines.md#mapmerge_cfe77ce) | (Public Preview) Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - | -| function(firstString, ...) | -| [stringConcat(firstString, secondString, otherStrings)](./firestore_lite_pipelines.md#stringconcat_8a8d1b6) | (Public Preview) Creates an expression that concatenates string expressions together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat(field("firstName"), " ", field("lastName")); - -``` - | -| function(ifExpr, ...) | -| [ifAbsent(ifExpr, elseExpr)](./firestore_lite_pipelines.md#ifabsent_0e6d161) | (Public Preview) Creates an expression that returns the elseExpr argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent(field("optional_field"), constant("default_value")) - -``` - | -| [ifAbsent(ifExpr, elseValue)](./firestore_lite_pipelines.md#ifabsent_c34e5ed) | (Public Preview) Creates an expression that returns the elseValue argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent(field("optional_field"), "default_value") - -``` - | -| function(ifFieldName, ...) | -| [ifAbsent(ifFieldName, elseExpr)](./firestore_lite_pipelines.md#ifabsent_e6dabea) | (Public Preview) Creates an expression that returns the elseExpr argument if ifFieldName is absent, else return the value of the field. -```typescript -// Returns the value of the optional field 'optional_field', or returns the value of -// 'default_field' if 'optional_field' is absent. -ifAbsent("optional_field", field("default_field")) - -``` - | -| [ifAbsent(ifFieldName, elseValue)](./firestore_lite_pipelines.md#ifabsent_d8f2823) | (Public Preview) Creates an expression that returns the elseValue argument if ifFieldName is absent, else return the value of the field. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent("optional_field", "default_value") - -``` - | -| function(input, ...) | -| [substring(input, position, length)](./firestore_lite_pipelines.md#substring_e6e0aa3) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | -| [substring(input, position, length)](./firestore_lite_pipelines.md#substring_ab56dc6) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | -| function(left, ...) | -| [divide(left, right)](./firestore_lite_pipelines.md#divide_b3c3382) | (Public Preview) Creates an expression that divides two expressions. -```typescript -// Divide the 'total' field by the 'count' field -divide(field("total"), field("count")); - -``` - | -| [equal(left, right)](./firestore_lite_pipelines.md#equal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are equal. -```typescript -// Check if the 'age' field is equal to an expression -equal(field("age"), field("minAge").add(10)); - -``` - | -| [greaterThan(left, right)](./firestore_lite_pipelines.md#greaterthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than the second expression. -```typescript -// Check if the 'age' field is greater than 18 -greaterThan(field("age"), Constant(9).add(9)); - -``` - | -| [greaterThanOrEqual(left, right)](./firestore_lite_pipelines.md#greaterthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than or equal to the second expression. -```typescript -// Check if the 'quantity' field is greater than or equal to the field "threshold" -greaterThanOrEqual(field("quantity"), field("threshold")); - -``` - | -| [lessThan(left, right)](./firestore_lite_pipelines.md#lessthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than the second expression. -```typescript -// Check if the 'age' field is less than 30 -lessThan(field("age"), field("limit")); - -``` - | -| [lessThanOrEqual(left, right)](./firestore_lite_pipelines.md#lessthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than or equal to the second expression. -```typescript -// Check if the 'quantity' field is less than or equal to 20 -lessThan(field("quantity"), field("limit")); - -``` - | -| [mod(left, right)](./firestore_lite_pipelines.md#mod_b3c3382) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing two expressions. -```typescript -// Calculate the remainder of dividing 'field1' by 'field2'. -mod(field("field1"), field("field2")); - -``` - | -| [notEqual(left, right)](./firestore_lite_pipelines.md#notequal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are not equal. -```typescript -// Check if the 'status' field is not equal to field 'finalState' -notEqual(field("status"), field("finalState")); - -``` - | -| [subtract(left, right)](./firestore_lite_pipelines.md#subtract_b3c3382) | (Public Preview) Creates an expression that subtracts two expressions. -```typescript -// Subtract the 'discount' field from the 'price' field -subtract(field("price"), field("discount")); - -``` - | -| function(mapExpr, ...) | -| [mapRemove(mapExpr, key)](./firestore_lite_pipelines.md#mapremove_23c7d51) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. -``` -// Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), 'baz'); - -``` - | -| [mapRemove(mapExpr, keyExpr)](./firestore_lite_pipelines.md#mapremove_9fbcaa3) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. -``` -// Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), constant('baz')); - -``` - | -| function(mapExpression, ...) | -| [mapGet(mapExpression, subField)](./firestore_lite_pipelines.md#mapget_688c050) | (Public Preview) Accesses a value from a map (object) expression using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -mapGet(field("address"), "city"); - -``` - | -| function(mapField, ...) | -| [mapMerge(mapField, secondMap, otherMaps)](./firestore_lite_pipelines.md#mapmerge_70a564b) | (Public Preview) Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge('settings', { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - | -| [mapRemove(mapField, key)](./firestore_lite_pipelines.md#mapremove_bd5726e) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. -``` -// Removes the key 'city' field from the map in the address field of the input document. -mapRemove('address', 'city'); - -``` - | -| [mapRemove(mapField, keyExpr)](./firestore_lite_pipelines.md#mapremove_8406d13) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. -``` -// Removes the key 'city' field from the map in the address field of the input document. -mapRemove('address', constant('city')); - -``` - | -| function(name, ...) | -| [field(name)](./firestore_lite_pipelines.md#field_1eaaff4) | (Public Preview) Creates a instance representing the field at the given path.The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city"). -```typescript -// Create a Field instance for the 'title' field -const titleField = field("title"); - -// Create a Field instance for a nested field 'author.firstName' -const authorFirstNameField = field("author.firstName"); - -``` - | -| function(path, ...) | -| [field(path)](./firestore_lite_pipelines.md#field_34ee07d) | (Public Preview) Creates a instance representing the field at the given path. | -| function(pipeline, ...) | -| [execute(pipeline)](./firestore_lite_pipelines.md#execute_01df620) | (Public Preview) Executes this pipeline and returns a Promise to represent the asynchronous operation.The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously.The pipeline results are returned as a that contains a list of objects. Each typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example:

  • If there are no stages or only transformation stages, each represents a single document.
  • If there is an aggregation, only a single is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each represents a distinct group and its associated aggregated values.

Example: -```typescript -const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") - .where(gt(field("rating"), 4.5)) - .select("title", "author", "rating")); - -const results: PipelineResults = snapshot.results; - -``` - | -| function(stringExpression, ...) | -| [charLength(stringExpression)](./firestore_lite_pipelines.md#charlength_c25a54a) | (Public Preview) Creates an expression that calculates the character length of a string expression in UTF-8. -```typescript -// Get the character length of the 'name' field in UTF-8. -strLength(field("name")); - -``` - | -| [endsWith(stringExpression, suffix)](./firestore_lite_pipelines.md#endswith_0a0b889) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." -endsWith(field("fullName"), "Jr."); - -``` - | -| [endsWith(stringExpression, suffix)](./firestore_lite_pipelines.md#endswith_13aee0d) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." -endsWith(field("fullName"), constant("Jr.")); - -``` - | -| [like(stringExpression, pattern)](./firestore_lite_pipelines.md#like_a84c581) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. -```typescript -// Check if the 'title' field contains the string "guide" -like(field("title"), "%guide%"); - -``` - | -| [like(stringExpression, pattern)](./firestore_lite_pipelines.md#like_b534848) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. -```typescript -// Check if the 'title' field contains the string "guide" -like(field("title"), field("pattern")); - -``` - | -| [regexContains(stringExpression, pattern)](./firestore_lite_pipelines.md#regexcontains_a84c581) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains(field("description"), "(?i)example"); - -``` - | -| [regexContains(stringExpression, pattern)](./firestore_lite_pipelines.md#regexcontains_b534848) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains(field("description"), field("pattern")); - -``` - | -| [regexMatch(stringExpression, pattern)](./firestore_lite_pipelines.md#regexmatch_a84c581) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch(field("email"), "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); - -``` - | -| [regexMatch(stringExpression, pattern)](./firestore_lite_pipelines.md#regexmatch_b534848) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch(field("email"), field("pattern")); - -``` - | -| [reverse(stringExpression)](./firestore_lite_pipelines.md#reverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. -```typescript -// Reverse the value of the 'myString' field. -reverse(field("myString")); - -``` - | -| [startsWith(stringExpression, prefix)](./firestore_lite_pipelines.md#startswith_75c3dbb) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." -startsWith(field("fullName"), "Mr."); - -``` - | -| [startsWith(stringExpression, prefix)](./firestore_lite_pipelines.md#startswith_52f218a) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." -startsWith(field("fullName"), field("prefix")); - -``` - | -| [stringContains(stringExpression, substring)](./firestore_lite_pipelines.md#stringcontains_3e9ff32) | (Public Preview) Creates an expression that checks if a string expression contains a specified substring. -```typescript -// Check if the 'description' field contains "example". -stringContains(field("description"), "example"); - -``` - | -| [stringContains(stringExpression, substring)](./firestore_lite_pipelines.md#stringcontains_cc6ee02) | (Public Preview) Creates an expression that checks if a string expression contains a substring specified by another expression. -```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -stringContains(field("description"), field("keyword")); - -``` - | -| [stringReverse(stringExpression)](./firestore_lite_pipelines.md#stringreverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. -```typescript -// Reverse the value of the 'myString' field. -strReverse(field("myString")); - -``` - | -| [toLower(stringExpression)](./firestore_lite_pipelines.md#tolower_c25a54a) | (Public Preview) Creates an expression that converts a string expression to lowercase. -```typescript -// Convert the 'name' field to lowercase -toLower(field("name")); - -``` - | -| [toUpper(stringExpression)](./firestore_lite_pipelines.md#toupper_c25a54a) | (Public Preview) Creates an expression that converts a string expression to uppercase. -```typescript -// Convert the 'title' field to uppercase -toUppercase(field("title")); - -``` - | -| [trim(stringExpression, valueToTrim)](./firestore_lite_pipelines.md#trim_dd54322) | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array expression. -```typescript -// Trim whitespace from the 'userInput' field -trim(field("userInput")); - -// Trim quotes from the 'userInput' field -trim(field("userInput"), '"'); - -``` - | +| [split(fieldName, delimiter)](./firestore_lite_pipelines.md#split_f4fe06a) | (Public Preview) Creates an expression that splits the value of a field on the provided delimiter. | +| [sqrt(fieldName)](./firestore_lite_pipelines.md#sqrt_e5b0480) | (Public Preview) Creates an expression that computes the square root of a numeric value. | +| [startsWith(fieldName, prefix)](./firestore_lite_pipelines.md#startswith_89325cc) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. | +| [startsWith(fieldName, prefix)](./firestore_lite_pipelines.md#startswith_266c338) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. | +| [stringConcat(fieldName, secondString, otherStrings)](./firestore_lite_pipelines.md#stringconcat_d80077e) | (Public Preview) Creates an expression that concatenates string functions, fields or constants together. | +| [stringContains(fieldName, substring)](./firestore_lite_pipelines.md#stringcontains_5b94cfe) | (Public Preview) Creates an expression that checks if a string field contains a specified substring. | +| [stringContains(fieldName, substring)](./firestore_lite_pipelines.md#stringcontains_ac3ba47) | (Public Preview) Creates an expression that checks if a string field contains a substring specified by an expression. | +| [subtract(fieldName, expression)](./firestore_lite_pipelines.md#subtract_1e91657) | (Public Preview) Creates an expression that subtracts an expression from a field's value. | +| [subtract(fieldName, value)](./firestore_lite_pipelines.md#subtract_65e2f32) | (Public Preview) Creates an expression that subtracts a constant value from a field's value. | +| [sum(fieldName)](./firestore_lite_pipelines.md#sum_e5b0480) | (Public Preview) Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. | +| [timestampAdd(fieldName, unit, amount)](./firestore_lite_pipelines.md#timestampadd_341fe7d) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp represented by a field. | +| [timestampSubtract(fieldName, unit, amount)](./firestore_lite_pipelines.md#timestampsubtract_341fe7d) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. | +| [timestampToUnixMicros(fieldName)](./firestore_lite_pipelines.md#timestamptounixmicros_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixMillis(fieldName)](./firestore_lite_pipelines.md#timestamptounixmillis_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixSeconds(fieldName)](./firestore_lite_pipelines.md#timestamptounixseconds_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampTruncate(fieldName, granularity, timezone)](./firestore_lite_pipelines.md#timestamptruncate_b6c7512) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | +| [timestampTruncate(fieldName, granularity, timezone)](./firestore_lite_pipelines.md#timestamptruncate_ed83d46) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | +| [toLower(fieldName)](./firestore_lite_pipelines.md#tolower_e5b0480) | (Public Preview) Creates an expression that converts a string field to lowercase. | +| [toUpper(fieldName)](./firestore_lite_pipelines.md#toupper_e5b0480) | (Public Preview) Creates an expression that converts a string field to uppercase. | +| [trim(fieldName, valueToTrim)](./firestore_lite_pipelines.md#trim_c9f90ee) | (Public Preview) Creates an expression that removes leading and trailing whitespace from a string or byte array. | +| [type(fieldName)](./firestore_lite_pipelines.md#type_e5b0480) | (Public Preview) Creates an expression that returns the data type of the data in the specified field. | +| [unixMicrosToTimestamp(fieldName)](./firestore_lite_pipelines.md#unixmicrostotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixMillisToTimestamp(fieldName)](./firestore_lite_pipelines.md#unixmillistotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixSecondsToTimestamp(fieldName)](./firestore_lite_pipelines.md#unixsecondstotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [vectorLength(fieldName)](./firestore_lite_pipelines.md#vectorlength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector represented by a field. | +| function(first, ...) | +| [add(first, second)](./firestore_lite_pipelines.md#add_846ca1b) | (Public Preview) Creates an expression that adds two expressions together. | +| [and(first, second, more)](./firestore_lite_pipelines.md#and_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'AND' operation on multiple filter conditions. | +| [concat(first, second, others)](./firestore_lite_pipelines.md#concat_83be015) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. | +| [logicalMaximum(first, second, others)](./firestore_lite_pipelines.md#logicalmaximum_83be015) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. | +| [logicalMinimum(first, second, others)](./firestore_lite_pipelines.md#logicalminimum_83be015) | (Public Preview) Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. | +| [multiply(first, second)](./firestore_lite_pipelines.md#multiply_846ca1b) | (Public Preview) Creates an expression that multiplies two expressions together. | +| [or(first, second, more)](./firestore_lite_pipelines.md#or_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'OR' operation on multiple filter conditions. | +| [xor(first, second, additionalConditions)](./firestore_lite_pipelines.md#xor_8197113) | (Public Preview) Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. | +| function(firstArray, ...) | +| [arrayConcat(firstArray, secondArray, otherArrays)](./firestore_lite_pipelines.md#arrayconcat_c00d5d7) | (Public Preview) Creates an expression that concatenates an array expression with other arrays. | +| function(firstArrayField, ...) | +| [arrayConcat(firstArrayField, secondArray, otherArrays)](./firestore_lite_pipelines.md#arrayconcat_f92063d) | (Public Preview) Creates an expression that concatenates a field's array value with other arrays. | +| function(firstMap, ...) | +| [mapMerge(firstMap, secondMap, otherMaps)](./firestore_lite_pipelines.md#mapmerge_cfe77ce) | (Public Preview) Creates an expression that merges multiple map values. | +| function(firstString, ...) | +| [stringConcat(firstString, secondString, otherStrings)](./firestore_lite_pipelines.md#stringconcat_8a8d1b6) | (Public Preview) Creates an expression that concatenates string expressions together. | +| function(ifExpr, ...) | +| [ifAbsent(ifExpr, elseExpr)](./firestore_lite_pipelines.md#ifabsent_0e6d161) | (Public Preview) Creates an expression that returns the elseExpr argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. | +| [ifAbsent(ifExpr, elseValue)](./firestore_lite_pipelines.md#ifabsent_c34e5ed) | (Public Preview) Creates an expression that returns the elseValue argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. | +| function(ifFieldName, ...) | +| [ifAbsent(ifFieldName, elseExpr)](./firestore_lite_pipelines.md#ifabsent_e6dabea) | (Public Preview) Creates an expression that returns the elseExpr argument if ifFieldName is absent, else return the value of the field. | +| [ifAbsent(ifFieldName, elseValue)](./firestore_lite_pipelines.md#ifabsent_d8f2823) | (Public Preview) Creates an expression that returns the elseValue argument if ifFieldName is absent, else return the value of the field. | +| function(input, ...) | +| [substring(input, position, length)](./firestore_lite_pipelines.md#substring_e6e0aa3) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | +| [substring(input, position, length)](./firestore_lite_pipelines.md#substring_ab56dc6) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | +| function(left, ...) | +| [divide(left, right)](./firestore_lite_pipelines.md#divide_b3c3382) | (Public Preview) Creates an expression that divides two expressions. | +| [equal(left, right)](./firestore_lite_pipelines.md#equal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are equal. | +| [greaterThan(left, right)](./firestore_lite_pipelines.md#greaterthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than the second expression. | +| [greaterThanOrEqual(left, right)](./firestore_lite_pipelines.md#greaterthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than or equal to the second expression. | +| [lessThan(left, right)](./firestore_lite_pipelines.md#lessthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than the second expression. | +| [lessThanOrEqual(left, right)](./firestore_lite_pipelines.md#lessthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than or equal to the second expression. | +| [mod(left, right)](./firestore_lite_pipelines.md#mod_b3c3382) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing two expressions. | +| [notEqual(left, right)](./firestore_lite_pipelines.md#notequal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are not equal. | +| [subtract(left, right)](./firestore_lite_pipelines.md#subtract_b3c3382) | (Public Preview) Creates an expression that subtracts two expressions. | +| function(mapExpr, ...) | +| [mapRemove(mapExpr, key)](./firestore_lite_pipelines.md#mapremove_23c7d51) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. | +| [mapRemove(mapExpr, keyExpr)](./firestore_lite_pipelines.md#mapremove_9fbcaa3) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. | +| function(mapExpression, ...) | +| [mapGet(mapExpression, subField)](./firestore_lite_pipelines.md#mapget_688c050) | (Public Preview) Accesses a value from a map (object) expression using the provided key. | +| function(mapField, ...) | +| [mapMerge(mapField, secondMap, otherMaps)](./firestore_lite_pipelines.md#mapmerge_70a564b) | (Public Preview) Creates an expression that merges multiple map values. | +| [mapRemove(mapField, key)](./firestore_lite_pipelines.md#mapremove_bd5726e) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. | +| [mapRemove(mapField, keyExpr)](./firestore_lite_pipelines.md#mapremove_8406d13) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. | +| function(name, ...) | +| [field(name)](./firestore_lite_pipelines.md#field_1eaaff4) | (Public Preview) Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path.The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city"). | +| function(path, ...) | +| [field(path)](./firestore_lite_pipelines.md#field_34ee07d) | (Public Preview) Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path. | +| function(pipeline, ...) | +| [execute(pipeline)](./firestore_lite_pipelines.md#execute_01df620) | (Public Preview) Executes this pipeline and returns a Promise to represent the asynchronous operation.The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously.The pipeline results are returned as a [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) that contains a list of [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects. Each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example:

  • If there are no stages or only transformation stages, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a single document.
  • If there is an aggregation, only a single [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a distinct group and its associated aggregated values.
| +| function(stringExpression, ...) | +| [charLength(stringExpression)](./firestore_lite_pipelines.md#charlength_c25a54a) | (Public Preview) Creates an expression that calculates the character length of a string expression in UTF-8. | +| [endsWith(stringExpression, suffix)](./firestore_lite_pipelines.md#endswith_0a0b889) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. | +| [endsWith(stringExpression, suffix)](./firestore_lite_pipelines.md#endswith_13aee0d) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. | +| [like(stringExpression, pattern)](./firestore_lite_pipelines.md#like_a84c581) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. | +| [like(stringExpression, pattern)](./firestore_lite_pipelines.md#like_b534848) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. | +| [regexContains(stringExpression, pattern)](./firestore_lite_pipelines.md#regexcontains_a84c581) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. | +| [regexContains(stringExpression, pattern)](./firestore_lite_pipelines.md#regexcontains_b534848) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. | +| [regexMatch(stringExpression, pattern)](./firestore_lite_pipelines.md#regexmatch_a84c581) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. | +| [regexMatch(stringExpression, pattern)](./firestore_lite_pipelines.md#regexmatch_b534848) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. | +| [reverse(stringExpression)](./firestore_lite_pipelines.md#reverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. | +| [startsWith(stringExpression, prefix)](./firestore_lite_pipelines.md#startswith_75c3dbb) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. | +| [startsWith(stringExpression, prefix)](./firestore_lite_pipelines.md#startswith_52f218a) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. | +| [stringContains(stringExpression, substring)](./firestore_lite_pipelines.md#stringcontains_3e9ff32) | (Public Preview) Creates an expression that checks if a string expression contains a specified substring. | +| [stringContains(stringExpression, substring)](./firestore_lite_pipelines.md#stringcontains_cc6ee02) | (Public Preview) Creates an expression that checks if a string expression contains a substring specified by another expression. | +| [stringReverse(stringExpression)](./firestore_lite_pipelines.md#stringreverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. | +| [toLower(stringExpression)](./firestore_lite_pipelines.md#tolower_c25a54a) | (Public Preview) Creates an expression that converts a string expression to lowercase. | +| [toUpper(stringExpression)](./firestore_lite_pipelines.md#toupper_c25a54a) | (Public Preview) Creates an expression that converts a string expression to uppercase. | +| [trim(stringExpression, valueToTrim)](./firestore_lite_pipelines.md#trim_dd54322) | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array expression. | | function(timestamp, ...) | -| [timestampAdd(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampadd_98418f9) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. -```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -timestampAdd(field("timestamp"), field("unit"), field("amount")); - -``` - | -| [timestampAdd(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampadd_ffe8e57) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. -```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd(field("timestamp"), "day", 1); - -``` - | -| [timestampSubtract(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampsubtract_98418f9) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. -```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -timestampSubtract(field("timestamp"), field("unit"), field("amount")); - -``` - | -| [timestampSubtract(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampsubtract_ffe8e57) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. -```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract(field("timestamp"), "day", 1); - -``` - | +| [timestampAdd(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampadd_98418f9) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. | +| [timestampAdd(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampadd_ffe8e57) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. | +| [timestampSubtract(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampsubtract_98418f9) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. | +| [timestampSubtract(timestamp, unit, amount)](./firestore_lite_pipelines.md#timestampsubtract_ffe8e57) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. | | function(timestampExpression, ...) | | [timestampTruncate(timestampExpression, granularity, timezone)](./firestore_lite_pipelines.md#timestamptruncate_ad5d843) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | | [timestampTruncate(timestampExpression, granularity, timezone)](./firestore_lite_pipelines.md#timestamptruncate_d6ab2a4) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | | function(tryExpr, ...) | -| [ifError(tryExpr, catchExpr)](./firestore_lite_pipelines.md#iferror_a99a327) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation.This overload is useful when a BooleanExpression is required. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -ifError(constant(50).divide('length').gt(1), constant(false)); - -``` - | -| [ifError(tryExpr, catchExpr)](./firestore_lite_pipelines.md#iferror_756c12e) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. -```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -ifError(field("title").arrayGet(0), field("title")); - -``` - | -| [ifError(tryExpr, catchValue)](./firestore_lite_pipelines.md#iferror_dc532f9) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. -```typescript -// Returns the first item in the title field arrays, or returns -// "Default Title" -ifError(field("title").arrayGet(0), "Default Title"); - -``` - | +| [ifError(tryExpr, catchExpr)](./firestore_lite_pipelines.md#iferror_a99a327) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation.This overload is useful when a BooleanExpression is required. | +| [ifError(tryExpr, catchExpr)](./firestore_lite_pipelines.md#iferror_756c12e) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. | +| [ifError(tryExpr, catchValue)](./firestore_lite_pipelines.md#iferror_dc532f9) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. | | function(value, ...) | | [constant(value)](./firestore_lite_pipelines.md#constant_0c00f91) | (Public Preview) Creates a Constant instance for a number value. | | [constant(value)](./firestore_lite_pipelines.md#constant_6dac335) | (Public Preview) Creates a Constant instance for a VectorValue value. | @@ -1639,78 +297,17 @@ ifError(field("title").arrayGet(0), "Default Title"); | [constant(value)](./firestore_lite_pipelines.md#constant_5131bf7) | (Public Preview) Creates a Constant instance for a Date value. | | [constant(value)](./firestore_lite_pipelines.md#constant_fdf565d) | (Public Preview) Creates a Constant instance for a Bytes value. | | [constant(value)](./firestore_lite_pipelines.md#constant_bcd2b0b) | (Public Preview) Creates a Constant instance for a DocumentReference value. | -| [exists(value)](./firestore_lite_pipelines.md#exists_f3daf14) | (Public Preview) Creates an expression that checks if a field exists. -```typescript -// Check if the document has a field named "phoneNumber" -exists(field("phoneNumber")); - -``` - | -| [isAbsent(value)](./firestore_lite_pipelines.md#isabsent_f3daf14) | (Public Preview) Creates an expression that returns true if a value is absent. Otherwise, returns false even if the value is null. -```typescript -// Check if the field `value` is absent. -isAbsent(field("value")); - -``` - | -| [isError(value)](./firestore_lite_pipelines.md#iserror_f3daf14) | (Public Preview) Creates an expression that checks if a given expression produces an error. -```typescript -// Check if the result of a calculation is an error -isError(field("title").arrayContains(1)); - -``` - | +| [exists(value)](./firestore_lite_pipelines.md#exists_f3daf14) | (Public Preview) Creates an expression that checks if a field exists. | +| [isAbsent(value)](./firestore_lite_pipelines.md#isabsent_f3daf14) | (Public Preview) Creates an expression that returns true if a value is absent. Otherwise, returns false even if the value is null. | +| [isError(value)](./firestore_lite_pipelines.md#iserror_f3daf14) | (Public Preview) Creates an expression that checks if a given expression produces an error. | | function(vectorExpression, ...) | -| [cosineDistance(vectorExpression, vector)](./firestore_lite_pipelines.md#cosinedistance_3a80317) | (Public Preview) Calculates the Cosine distance between a vector expression and a vector literal. -```typescript -// Calculate the cosine distance between the 'location' field and a target location -cosineDistance(field("location"), [37.7749, -122.4194]); - -``` - | -| [cosineDistance(vectorExpression, otherVectorExpression)](./firestore_lite_pipelines.md#cosinedistance_17b5bcc) | (Public Preview) Calculates the Cosine distance between two vector expressions. -```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -cosineDistance(field("userVector"), field("itemVector")); - -``` - | -| [dotProduct(vectorExpression, vector)](./firestore_lite_pipelines.md#dotproduct_3a80317) | (Public Preview) Calculates the dot product between a vector expression and a double array. -```typescript -// Calculate the dot product between a feature vector and a target vector -dotProduct(field("features"), [0.5, 0.8, 0.2]); - -``` - | -| [dotProduct(vectorExpression, otherVectorExpression)](./firestore_lite_pipelines.md#dotproduct_17b5bcc) | (Public Preview) Calculates the dot product between two vector expressions. -```typescript -// Calculate the dot product between two document vectors: 'docVector1' and 'docVector2' -dotProduct(field("docVector1"), field("docVector2")); - -``` - | -| [euclideanDistance(vectorExpression, vector)](./firestore_lite_pipelines.md#euclideandistance_3a80317) | (Public Preview) Calculates the Euclidean distance between a vector expression and a double array. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location - -euclideanDistance(field("location"), [37.7749, -122.4194]); - -``` - | -| [euclideanDistance(vectorExpression, otherVectorExpression)](./firestore_lite_pipelines.md#euclideandistance_17b5bcc) | (Public Preview) Calculates the Euclidean distance between two vector expressions. -```typescript -// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' -euclideanDistance(field("pointA"), field("pointB")); - -``` - | -| [vectorLength(vectorExpression)](./firestore_lite_pipelines.md#vectorlength_58a039b) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector. -```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength(field("embedding")); - -``` - | +| [cosineDistance(vectorExpression, vector)](./firestore_lite_pipelines.md#cosinedistance_3a80317) | (Public Preview) Calculates the Cosine distance between a vector expression and a vector literal. | +| [cosineDistance(vectorExpression, otherVectorExpression)](./firestore_lite_pipelines.md#cosinedistance_17b5bcc) | (Public Preview) Calculates the Cosine distance between two vector expressions. | +| [dotProduct(vectorExpression, vector)](./firestore_lite_pipelines.md#dotproduct_3a80317) | (Public Preview) Calculates the dot product between a vector expression and a double array. | +| [dotProduct(vectorExpression, otherVectorExpression)](./firestore_lite_pipelines.md#dotproduct_17b5bcc) | (Public Preview) Calculates the dot product between two vector expressions. | +| [euclideanDistance(vectorExpression, vector)](./firestore_lite_pipelines.md#euclideandistance_3a80317) | (Public Preview) Calculates the Euclidean distance between a vector expression and a double array. | +| [euclideanDistance(vectorExpression, otherVectorExpression)](./firestore_lite_pipelines.md#euclideandistance_17b5bcc) | (Public Preview) Calculates the Euclidean distance between two vector expressions. | +| [vectorLength(vectorExpression)](./firestore_lite_pipelines.md#vectorlength_58a039b) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector. | ## Classes @@ -1724,52 +321,22 @@ vectorLength(field("embedding")); | [CollectionReference](./firestore_lite_pipelines.collectionreference.md#collectionreference_class) | A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using [query()](./firestore_.md#query_9f7b0f4)). | | [DocumentReference](./firestore_lite_pipelines.documentreference.md#documentreference_class) | A DocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist. | | [DocumentSnapshot](./firestore_lite_pipelines.documentsnapshot.md#documentsnapshot_class) | A DocumentSnapshot contains data read from a document in your Firestore database. The data can be extracted with .data() or .get(<field>) to get a specific field.For a DocumentSnapshot that points to a non-existing document, any data access will return 'undefined'. You can use the exists() method to explicitly verify a document's existence. | -| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | (Public Preview) Represents an expression that can be evaluated to a value within the execution of a .Expressions are the building blocks for creating complex queries and transformations in Firestore pipelines. They can represent:- \*\*Field references:\*\* Access values from document fields. - \*\*Literals:\*\* Represent constant values (strings, numbers, booleans). - \*\*Function calls:\*\* Apply functions to one or more expressions.The Expr class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. | -| [Field](./firestore_lite_pipelines.field.md#field_class) | (Public Preview) Represents a reference to a field in a Firestore document, or outputs of a stage.

Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.

You can create a Field instance using the static method: -```typescript -// Create a Field instance for the 'name' field -const nameField = field("name"); - -// Create a Field instance for a nested field 'address.city' -const cityField = field("address.city"); - -``` - | +| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | (Public Preview) Represents an expression that can be evaluated to a value within the execution of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class).Expressions are the building blocks for creating complex queries and transformations in Firestore pipelines. They can represent:- \*\*Field references:\*\* Access values from document fields. - \*\*Literals:\*\* Represent constant values (strings, numbers, booleans). - \*\*Function calls:\*\* Apply functions to one or more expressions.The Expression class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. | +| [Field](./firestore_lite_pipelines.field.md#field_class) | (Public Preview) Represents a reference to a field in a Firestore document, or outputs of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) stage.

Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.

You can create a Field instance using the static method: | | [FieldPath](./firestore_lite_pipelines.fieldpath.md#fieldpath_class) | A FieldPath refers to a field in a document. The path may consist of a single field name (referring to a top-level field in the document), or a list of field names (referring to a nested field in the document).Create a FieldPath by providing field names. If more than one field name is provided, the path will point to a nested field in a document. | | [FieldValue](./firestore_lite_pipelines.fieldvalue.md#fieldvalue_class) | Sentinel values that can be used when writing document fields with set() or update(). | | [Firestore](./firestore_lite_pipelines.firestore.md#firestore_class) | The Cloud Firestore service interface.Do not call this constructor directly. Instead, use [getFirestore()](./firestore_.md#getfirestore). | -| [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) | (Public Preview) This class defines the base class for Firestore functions, which can be evaluated within pipeline execution.Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_.md#and_e72c712), , or the methods on (, , etc.) to construct new Function instances. | +| [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) | (Public Preview) This class defines the base class for Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) functions, which can be evaluated within pipeline execution.Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_pipelines.md#and_e0c48bd), [equal()](./firestore_pipelines.md#equal_b3c3382), or the methods on [Expression](./firestore_pipelines.expression.md#expression_class) ([Expression.equal()](./firestore_pipelines.expression.md#expressionequal), [Expression.lessThan()](./firestore_pipelines.expression.md#expressionlessthan), etc.) to construct new Function instances. | | [GeoPoint](./firestore_lite_pipelines.geopoint.md#geopoint_class) | An immutable object representing a geographic location in Firestore. The location is represented as latitude/longitude pair.Latitude values are in the range of \[-90, 90\]. Longitude values are in the range of \[-180, 180\]. | | [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) | (Public Preview) Represents an ordering criterion for sorting documents in a Firestore pipeline.You create Ordering instances using the ascending and descending helper functions. | -| [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) | (Public Preview) The Pipeline class provides a flexible and expressive framework for building complex data transformation and query pipelines for Firestore.A pipeline takes data sources, such as Firestore collections or collection groups, and applies a series of stages that are chained together. Each stage takes the output from the previous stage (or the data source) and produces an output for the next stage (or as the final output of the pipeline).Expressions can be used within each stage to filter and transform data through the stage.NOTE: The chained stages do not prescribe exactly how Firestore will execute the pipeline. Instead, Firestore only guarantees that the result is the same as if the chained stages were executed in order.Usage Examples: -```typescript -const db: Firestore; // Assumes a valid firestore instance. - -// Example 1: Select specific fields and rename 'rating' to 'bookRating' -const results1 = await execute(db.pipeline() - .collection("books") - .select("title", "author", field("rating").as("bookRating"))); - -// Example 2: Filter documents where 'genre' is "Science Fiction" and 'published' is after 1950 -const results2 = await execute(db.pipeline() - .collection("books") - .where(and(field("genre").eq("Science Fiction"), field("published").gt(1950)))); - -// Example 3: Calculate the average rating of books published after 1980 -const results3 = await execute(db.pipeline() - .collection("books") - .where(field("published").gt(1980)) - .aggregate(avg(field("rating")).as("averageRating"))); - -``` - | -| [PipelineResult](./firestore_lite_pipelines.pipelineresult.md#pipelineresult_class) | (Public Preview) A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the or methods.

If the PipelineResult represents a non-document result, ref will return a undefined value. | -| [PipelineSnapshot](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) | (Public Preview) Represents the results of a Firestore pipeline execution.A PipelineSnapshot contains zero or more objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. | -| [PipelineSource](./firestore_lite_pipelines.pipelinesource.md#pipelinesource_class) | (Public Preview) Provides the entry point for defining the data source of a Firestore .Use the methods of this class (e.g., , , , or ) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. | +| [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) | (Public Preview) The Pipeline class provides a flexible and expressive framework for building complex data transformation and query pipelines for Firestore.A pipeline takes data sources, such as Firestore collections or collection groups, and applies a series of stages that are chained together. Each stage takes the output from the previous stage (or the data source) and produces an output for the next stage (or as the final output of the pipeline).Expressions can be used within each stage to filter and transform data through the stage.NOTE: The chained stages do not prescribe exactly how Firestore will execute the pipeline. Instead, Firestore only guarantees that the result is the same as if the chained stages were executed in order.Usage Examples: | +| [PipelineResult](./firestore_lite_pipelines.pipelineresult.md#pipelineresult_class) | (Public Preview) A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the [PipelineResult.data()](./firestore_pipelines.pipelineresult.md#pipelineresultdata) or [PipelineResult.get()](./firestore_pipelines.pipelineresult.md#pipelineresultget) methods.

If the PipelineResult represents a non-document result, ref will return a undefined value. | +| [PipelineSnapshot](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) | (Public Preview) Represents the results of a Firestore pipeline execution.A PipelineSnapshot contains zero or more [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. | +| [PipelineSource](./firestore_lite_pipelines.pipelinesource.md#pipelinesource_class) | (Public Preview) Provides the entry point for defining the data source of a Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class).Use the methods of this class (e.g., [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection), [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup), [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase), or [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments)) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. | | [Query](./firestore_lite_pipelines.query.md#query_class) | A Query refers to a query which you can read or listen to. You can also construct refined Query objects by adding filters and ordering. | | [QueryDocumentSnapshot](./firestore_lite_pipelines.querydocumentsnapshot.md#querydocumentsnapshot_class) | A QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with .data() or .get(<field>) to get a specific field.A QueryDocumentSnapshot offers the same API surface as a DocumentSnapshot. Since query results contain only existing documents, the exists property will always be true and data() will never return 'undefined'. | | [Timestamp](./firestore_lite_pipelines.timestamp.md#timestamp_class) | A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.For examples and further specifications, refer to the [Timestamp definition](https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto). | -| [VectorValue](./firestore_lite_pipelines.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). VectorValue | +| [VectorValue](./firestore_lite_pipelines.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). | ## Interfaces @@ -1784,30 +351,30 @@ const results3 = await execute(db.pipeline() | Type Alias | Description | | --- | --- | -| [AddFieldsStageOptions](./firestore_lite_pipelines.md#addfieldsstageoptions) | (Public Preview) Options defining how an AddFieldsStage is evaluated. See . | -| [AggregateStageOptions](./firestore_lite_pipelines.md#aggregatestageoptions) | (Public Preview) Options defining how an AggregateStage is evaluated. See . | -| [CollectionGroupStageOptions](./firestore_lite_pipelines.md#collectiongroupstageoptions) | (Public Preview) Defines the configuration options for a within a pipeline. This type extends and provides specific settings for how a collection group is identified and processed during pipeline execution. | -| [CollectionStageOptions](./firestore_lite_pipelines.md#collectionstageoptions) | (Public Preview) Options defining how a CollectionStage is evaluated. See . | -| [DatabaseStageOptions](./firestore_lite_pipelines.md#databasestageoptions) | (Public Preview) Options defining how a DatabaseStage is evaluated. See . | -| [DistinctStageOptions](./firestore_lite_pipelines.md#distinctstageoptions) | (Public Preview) Options defining how a DistinctStage is evaluated. See . | -| [DocumentsStageOptions](./firestore_lite_pipelines.md#documentsstageoptions) | (Public Preview) Options defining how a DocumentsStage is evaluated. See . | +| [AddFieldsStageOptions](./firestore_lite_pipelines.md#addfieldsstageoptions) | (Public Preview) Options defining how an AddFieldsStage is evaluated. See [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields). | +| [AggregateStageOptions](./firestore_lite_pipelines.md#aggregatestageoptions) | (Public Preview) Options defining how an AggregateStage is evaluated. See [Pipeline.aggregate()](./firestore_pipelines.pipeline.md#pipelineaggregate). | +| [CollectionGroupStageOptions](./firestore_lite_pipelines.md#collectiongroupstageoptions) | (Public Preview) Defines the configuration options for a CollectionGroupStage within a pipeline. This type extends [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) and provides specific settings for how a collection group is identified and processed during pipeline execution.See [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) to create a collection group stage. | +| [CollectionStageOptions](./firestore_lite_pipelines.md#collectionstageoptions) | (Public Preview) Options defining how a CollectionStage is evaluated. See [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection). | +| [DatabaseStageOptions](./firestore_lite_pipelines.md#databasestageoptions) | (Public Preview) Options defining how a DatabaseStage is evaluated. See [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase). | +| [DistinctStageOptions](./firestore_lite_pipelines.md#distinctstageoptions) | (Public Preview) Options defining how a DistinctStage is evaluated. See [Pipeline.distinct()](./firestore_pipelines.pipeline.md#pipelinedistinct). | +| [DocumentsStageOptions](./firestore_lite_pipelines.md#documentsstageoptions) | (Public Preview) Options defining how a DocumentsStage is evaluated. See [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments). | | [ExpressionType](./firestore_lite_pipelines.md#expressiontype) | (Public Preview) An enumeration of the different types of expressions. | -| [FindNearestStageOptions](./firestore_lite_pipelines.md#findneareststageoptions) | (Public Preview) Options defining how a FindNearestStage is evaluated. See . | -| [LimitStageOptions](./firestore_lite_pipelines.md#limitstageoptions) | (Public Preview) Options defining how a LimitStage is evaluated. See . | -| [OffsetStageOptions](./firestore_lite_pipelines.md#offsetstageoptions) | (Public Preview) Options defining how an OffsetStage is evaluated. See . | -| [OneOf](./firestore_lite_pipelines.md#oneof) | (Public Preview) Utility type to create an type that only allows one property of the Type param T to be set.type XorY = OneOf<{ x: unknown, y: unknown}> let a = { x: "foo" } // OK let b = { y: "foo" } // OK let c = { a: "foo", y: "foo" } // Not OK | +| [FindNearestStageOptions](./firestore_lite_pipelines.md#findneareststageoptions) | (Public Preview) Options defining how a FindNearestStage is evaluated. See [Pipeline.findNearest()](./firestore_pipelines.pipeline.md#pipelinefindnearest). | +| [LimitStageOptions](./firestore_lite_pipelines.md#limitstageoptions) | (Public Preview) Options defining how a LimitStage is evaluated. See [Pipeline.limit()](./firestore_pipelines.pipeline.md#pipelinelimit). | +| [OffsetStageOptions](./firestore_lite_pipelines.md#offsetstageoptions) | (Public Preview) Options defining how an OffsetStage is evaluated. See [Pipeline.offset()](./firestore_pipelines.pipeline.md#pipelineoffset). | +| [OneOf](./firestore_lite_pipelines.md#oneof) | (Public Preview) Utility type to create an type that only allows one property of the Type param T to be set. | | [PartialWithFieldValue](./firestore_lite_pipelines.md#partialwithfieldvalue) | Similar to TypeScript's Partial<T>, but allows nested fields to be omitted and FieldValues to be passed in as property values. | | [Primitive](./firestore_lite_pipelines.md#primitive) | Primitive types. | -| [RemoveFieldsStageOptions](./firestore_lite_pipelines.md#removefieldsstageoptions) | (Public Preview) Options defining how a RemoveFieldsStage is evaluated. See . | -| [ReplaceWithStageOptions](./firestore_lite_pipelines.md#replacewithstageoptions) | (Public Preview) Options defining how a ReplaceWithStage is evaluated. See . | -| [SampleStageOptions](./firestore_lite_pipelines.md#samplestageoptions) | (Public Preview) Defines the options for evaluating a sample stage within a pipeline. This type combines common with a specific configuration where only one of the defined sampling methods can be applied.See to create a sample stage.. | -| [SelectStageOptions](./firestore_lite_pipelines.md#selectstageoptions) | (Public Preview) Options defining how a SelectStage is evaluated. See . | +| [RemoveFieldsStageOptions](./firestore_lite_pipelines.md#removefieldsstageoptions) | (Public Preview) Options defining how a RemoveFieldsStage is evaluated. See [Pipeline.removeFields()](./firestore_pipelines.pipeline.md#pipelineremovefields). | +| [ReplaceWithStageOptions](./firestore_lite_pipelines.md#replacewithstageoptions) | (Public Preview) Options defining how a ReplaceWithStage is evaluated. See [Pipeline.replaceWith()](./firestore_pipelines.pipeline.md#pipelinereplacewith). | +| [SampleStageOptions](./firestore_lite_pipelines.md#samplestageoptions) | (Public Preview) Defines the options for evaluating a sample stage within a pipeline. This type combines common [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) with a specific configuration where only one of the defined sampling methods can be applied.See [Pipeline.sample()](./firestore_pipelines.pipeline.md#pipelinesample) to create a sample stage.. | +| [SelectStageOptions](./firestore_lite_pipelines.md#selectstageoptions) | (Public Preview) Options defining how a SelectStage is evaluated. See [Pipeline.select()](./firestore_pipelines.pipeline.md#pipelineselect). | | [SetOptions](./firestore_lite_pipelines.md#setoptions) | An options object that configures the behavior of [setDoc()](./firestore_lite.md#setdoc_ee215ad), and calls. These calls can be configured to perform granular merges instead of overwriting the target documents in their entirety by providing a SetOptions with merge: true. | -| [SortStageOptions](./firestore_lite_pipelines.md#sortstageoptions) | (Public Preview) Options defining how a SortStage is evaluated. See . | +| [SortStageOptions](./firestore_lite_pipelines.md#sortstageoptions) | (Public Preview) Options defining how a SortStage is evaluated. See [Pipeline.sort()](./firestore_pipelines.pipeline.md#pipelinesort). | | [TimeGranularity](./firestore_lite_pipelines.md#timegranularity) | (Public Preview) Specify time granularity for expressions. | -| [UnionStageOptions](./firestore_lite_pipelines.md#unionstageoptions) | (Public Preview) Options defining how a UnionStage is evaluated. See . | +| [UnionStageOptions](./firestore_lite_pipelines.md#unionstageoptions) | (Public Preview) Options defining how a UnionStage is evaluated. See [Pipeline.union()](./firestore_pipelines.pipeline.md#pipelineunion). | | [UnnestStageOptions](./firestore_lite_pipelines.md#unneststageoptions) | (Public Preview) Represents the specific options available for configuring an UnnestStage within a pipeline. | -| [WhereStageOptions](./firestore_lite_pipelines.md#wherestageoptions) | (Public Preview) Options defining how a WhereStage is evaluated. See . | +| [WhereStageOptions](./firestore_lite_pipelines.md#wherestageoptions) | (Public Preview) Options defining how a WhereStage is evaluated. See [Pipeline.where()](./firestore_pipelines.pipeline.md#pipelinewhere). | | [WithFieldValue](./firestore_lite_pipelines.md#withfieldvalue) | Allows FieldValues to be passed in as a property value while maintaining type safety. | ## function() @@ -1819,13 +386,6 @@ const results3 = await execute(db.pipeline() Creates an aggregation that counts the total number of stage inputs. -```typescript -// Count the total number of input documents -countAll().as("totalDocument"); - -``` - A new representing the 'countAll' aggregation. - Signature: ```typescript @@ -1835,19 +395,23 @@ export declare function countAll(): AggregateFunction; [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### currentTimestamp() {:#currenttimestamp} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'countAll' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that evaluates to the current server timestamp. ```typescript -// Get the current server timestamp -currentTimestamp() +// Count the total number of input documents +countAll().as("totalDocument"); ``` - A new Expression representing the current server timestamp. + +### currentTimestamp() {:#currenttimestamp} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that evaluates to the current server timestamp. Signature: @@ -1858,6 +422,17 @@ export declare function currentTimestamp(): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new Expression representing the current server timestamp. + +### Example + + +```typescript +// Get the current server timestamp +currentTimestamp() + +``` + ## function(array, ...) ### arrayContains(array, element) {:#arraycontains_a00ea48} @@ -1867,12 +442,6 @@ export declare function currentTimestamp(): FunctionExpression; Creates an expression that checks if an array expression contains a specific element. -```typescript -// Check if the 'colors' array contains the value of field 'selectedColor' -arrayContains(field("colors"), field("selectedColor")); - -``` - Signature: ```typescript @@ -1884,25 +453,30 @@ export declare function arrayContains(array: Expression, element: Expression): B | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The array expression to check. | -| element | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| element | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The element to search for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContains(array, element) {:#arraycontains_7328608} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains a specific element. ```typescript -// Check if the 'colors' array contains "red" -arrayContains(field("colors"), "red"); +// Check if the 'colors' array contains the value of field 'selectedColor' +arrayContains(field("colors"), field("selectedColor")); ``` +### arrayContains(array, element) {:#arraycontains_7328608} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains a specific element. + Signature: ```typescript @@ -1914,25 +488,30 @@ export declare function arrayContains(array: Expression, element: unknown): Bool | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The array expression to check. | -| element | unknown | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| element | unknown | The element to search for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(array, values) {:#arraycontainsall_c658ad5} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains all the specified elements. ```typescript -// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" -arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); +// Check if the 'colors' array contains "red" +arrayContains(field("colors"), "red"); ``` +### arrayContainsAll(array, values) {:#arraycontainsall_c658ad5} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains all the specified elements. + Signature: ```typescript @@ -1944,18 +523,16 @@ export declare function arrayContainsAll(array: Expression, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(array, arrayExpression) {:#arraycontainsall_7b535db} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains all the specified elements. ```typescript // Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" @@ -1963,6 +540,13 @@ arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]) ``` +### arrayContainsAll(array, arrayExpression) {:#arraycontainsall_7b535db} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains all the specified elements. + Signature: ```typescript @@ -1974,25 +558,30 @@ export declare function arrayContainsAll(array: Expression, arrayExpression: Exp | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The array expression to check. | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The elements to check for in the array. A new representing the 'array\_contains\_all' comparison. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(array, values) {:#arraycontainsany_c658ad5} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains any of the specified elements. ```typescript -// Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), [field("cate1"), "Science"]); +// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" +arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); ``` +### arrayContainsAny(array, values) {:#arraycontainsany_c658ad5} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains any of the specified elements. + Signature: ```typescript @@ -2004,25 +593,30 @@ export declare function arrayContainsAny(array: Expression, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(array, values) {:#arraycontainsany_c381a96} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains any of the specified elements. ```typescript // Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), array([field("cate1"), "Science"])); +arrayContainsAny(field("categories"), [field("cate1"), "Science"]); ``` +### arrayContainsAny(array, values) {:#arraycontainsany_c381a96} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains any of the specified elements. + Signature: ```typescript @@ -2034,25 +628,30 @@ export declare function arrayContainsAny(array: Expression, values: Expression): | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The array expression to check. | -| values | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for in the array. A new representing the 'array\_contains\_any' comparison. | +| values | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayLength(array) {:#arraylength_195e339} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of an array expression. ```typescript -// Get the number of items in the 'cart' array -arrayLength(field("cart")); +// Check if the 'categories' array contains either values from field "cate1" or "Science" +arrayContainsAny(field("categories"), array([field("cate1"), "Science"])); ``` +### arrayLength(array) {:#arraylength_195e339} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of an array expression. + Signature: ```typescript @@ -2063,11 +662,22 @@ export declare function arrayLength(array: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| array | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The array expression to calculate the length of. A new representing the length of the array. | +| array | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The array expression to calculate the length of. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. + +### Example + + +```typescript +// Get the number of items in the 'cart' array +arrayLength(field("cart")); + +``` ## function(arrayExpression, ...) @@ -2078,12 +688,6 @@ export declare function arrayLength(array: Expression): FunctionExpression; Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet(field('tags'), 1); - -``` - Signature: ```typescript @@ -2094,27 +698,31 @@ export declare function arrayGet(arrayExpression: Expression, offset: number): F | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expr evaluating to an array. | -| offset | number | The index of the element to return. A new Expr representing the 'arrayGet' operation. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expression evaluating to an array. | +| offset | number | The index of the element to return. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### arrayGet(arrayExpression, offsetExpr) {:#arrayget_484550d} +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet(field('tags'), field('favoriteTag')); +// Return the value in the tags field array at index 1. +arrayGet(field('tags'), 1); ``` +### arrayGet(arrayExpression, offsetExpr) {:#arrayget_484550d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript @@ -2125,26 +733,32 @@ export declare function arrayGet(arrayExpression: Expression, offsetExpr: Expres | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expr evaluating to an array. | -| offsetExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expr evaluating to the index of the element to return. A new Expr representing the 'arrayGet' operation. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expression evaluating to an array. | +| offsetExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expression evaluating to the index of the element to return. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### join(arrayExpression, delimiterExpression) {:#join_313e6aa} +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join an array of string using the delimiter from the 'separator' field. -join(array(['foo', 'bar']), field("separator")) +// Return the value in the tags field array at index specified by field +// 'favoriteTag'. +arrayGet(field('tags'), field('favoriteTag')); ``` +### join(arrayExpression, delimiterExpression) {:#join_313e6aa} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array into a string. + Signature: ```typescript @@ -2156,25 +770,30 @@ export declare function join(arrayExpression: Expression, delimiterExpression: E | Parameter | Type | Description | | --- | --- | --- | | arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array. | -| delimiterExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. A new Expression representing the join operation. | +| delimiterExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) -### join(arrayExpression, delimiter) {:#join_d088d29} +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join the elements of the 'tags' field with a comma and space. -join(field("tags"), ", ") +// Join an array of string using the delimiter from the 'separator' field. +join(array(['foo', 'bar']), field("separator")) ``` +### join(arrayExpression, delimiter) {:#join_d088d29} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array into a string. + Signature: ```typescript @@ -2186,12 +805,23 @@ export declare function join(arrayExpression: Expression, delimiter: string): Ex | Parameter | Type | Description | | --- | --- | --- | | arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array. | -| delimiter | string | The string to use as a delimiter. A new Expression representing the join operation. | +| delimiter | string | The string to use as a delimiter. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new Expression representing the join operation. + +### Example + + +```typescript +// Join the elements of the 'tags' field with a comma and space. +join(field("tags"), ", ") + +``` + ## function(arrayField, ...) ### arrayGet(arrayField, offset) {:#arrayget_3f58471} @@ -2201,12 +831,6 @@ export declare function join(arrayExpression: Expression, delimiter: string): Ex Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet('tags', 1); - -``` - Signature: ```typescript @@ -2218,26 +842,30 @@ export declare function arrayGet(arrayField: string, offset: number): FunctionEx | Parameter | Type | Description | | --- | --- | --- | | arrayField | string | The name of the array field. | -| offset | number | The index of the element to return. A new Expr representing the 'arrayGet' operation. | +| offset | number | The index of the element to return. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### arrayGet(arrayField, offsetExpr) {:#arrayget_1904c9a} +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet('tags', field('favoriteTag')); +// Return the value in the tags field array at index 1. +arrayGet('tags', 1); ``` +### arrayGet(arrayField, offsetExpr) {:#arrayget_1904c9a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript @@ -2249,12 +877,24 @@ export declare function arrayGet(arrayField: string, offsetExpr: Expression): Fu | Parameter | Type | Description | | --- | --- | --- | | arrayField | string | The name of the array field. | -| offsetExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expr evaluating to the index of the element to return. A new Expr representing the 'arrayGet' operation. | +| offsetExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An Expression evaluating to the index of the element to return. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the 'arrayGet' operation. + +### Example + + +```typescript +// Return the value in the tags field array at index specified by field +// 'favoriteTag'. +arrayGet('tags', field('favoriteTag')); + +``` + ## function(arrayFieldName, ...) ### join(arrayFieldName, delimiter) {:#join_478ef36} @@ -2264,12 +904,6 @@ export declare function arrayGet(arrayField: string, offsetExpr: Expression): Fu Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -join("tags", ", ") - -``` - Signature: ```typescript @@ -2281,25 +915,30 @@ export declare function join(arrayFieldName: string, delimiter: string): Express | Parameter | Type | Description | | --- | --- | --- | | arrayFieldName | string | The name of the field containing the array. | -| delimiter | string | The string to use as a delimiter. A new Expression representing the join operation. | +| delimiter | string | The string to use as a delimiter. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) -### join(arrayFieldName, delimiterExpression) {:#join_829294c} +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -join('tags', field("separator")) +// Join the elements of the 'tags' field with a comma and space. +join("tags", ", ") ``` +### join(arrayFieldName, delimiterExpression) {:#join_829294c} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array into a string. + Signature: ```typescript @@ -2311,12 +950,23 @@ export declare function join(arrayFieldName: string, delimiterExpression: Expres | Parameter | Type | Description | | --- | --- | --- | | arrayFieldName | string | The name of the field containing the array. | -| delimiterExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. A new Expression representing the join operation. | +| delimiterExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new Expression representing the join operation. + +### Example + + +```typescript +// Join the elements of the 'tags' field with the delimiter from the 'separator' field. +join('tags', field("separator")) + +``` + ## function(base, ...) ### pow(base, exponent) {:#pow_e4a9e64} @@ -2326,12 +976,6 @@ export declare function join(arrayFieldName: string, delimiterExpression: Expres Creates an expression that returns the value of the base expression raised to the power of the exponent expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow(field("base"), field("exponent")); - -``` - Signature: ```typescript @@ -2343,25 +987,30 @@ export declare function pow(base: Expression, exponent: Expression): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | base | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise to the power of the exponent. | -| exponent | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. A new Expr representing the power operation. | +| exponent | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### pow(base, exponent) {:#pow_93eae7f} +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of the base expression raised to the power of the exponent. ```typescript -// Raise the value of the 'base' field to the power of 2. -pow(field("base"), 2); +// Raise the value of the 'base' field to the power of the 'exponent' field. +pow(field("base"), field("exponent")); ``` +### pow(base, exponent) {:#pow_93eae7f} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of the base expression raised to the power of the exponent. + Signature: ```typescript @@ -2373,25 +1022,30 @@ export declare function pow(base: Expression, exponent: number): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | | base | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise to the power of the exponent. | -| exponent | number | The constant value to raise the base to the power of. A new Expr representing the power operation. | +| exponent | number | The constant value to raise the base to the power of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### pow(base, exponent) {:#pow_a237721} +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of the base field raised to the power of the exponent expression. ```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow("base", field("exponent")); +// Raise the value of the 'base' field to the power of 2. +pow(field("base"), 2); ``` +### pow(base, exponent) {:#pow_a237721} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of the base field raised to the power of the exponent expression. + Signature: ```typescript @@ -2403,25 +1057,30 @@ export declare function pow(base: string, exponent: Expression): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | | base | string | The name of the field to raise to the power of the exponent. | -| exponent | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. A new Expr representing the power operation. | +| exponent | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### pow(base, exponent) {:#pow_f4d7908} +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of the base field raised to the power of the exponent. ```typescript -// Raise the value of the 'base' field to the power of 2. -pow("base", 2); +// Raise the value of the 'base' field to the power of the 'exponent' field. +pow("base", field("exponent")); ``` +### pow(base, exponent) {:#pow_f4d7908} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of the base field raised to the power of the exponent. + Signature: ```typescript @@ -2433,12 +1092,23 @@ export declare function pow(base: string, exponent: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | base | string | The name of the field to raise to the power of the exponent. | -| exponent | number | The constant value to raise the base to the power of. A new Expr representing the power operation. | +| exponent | number | The constant value to raise the base to the power of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the power operation. + +### Example + + +```typescript +// Raise the value of the 'base' field to the power of 2. +pow("base", 2); + +``` + ## function(booleanExpr, ...) ### countIf(booleanExpr) {:#countif_c5b8fb1} @@ -2448,12 +1118,6 @@ export declare function pow(base: string, exponent: number): FunctionExpression; Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true. -```typescript -// Count the number of documents where 'is_active' field equals true -countIf(field("is_active").equal(true)).as("numActiveDocuments"); - -``` - Signature: ```typescript @@ -2472,6 +1136,15 @@ export declare function countIf(booleanExpr: BooleanExpression): AggregateFuncti A new `AggregateFunction` representing the 'countIf' aggregation. +### Example + + +```typescript +// Count the number of documents where 'is_active' field equals true +countIf(field("is_active").equal(true)).as("numActiveDocuments"); + +``` + ### not(booleanExpr) {:#not_c5b8fb1} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2479,12 +1152,6 @@ A new `AggregateFunction` representing the 'countIf' aggregation. Creates an expression that negates a filter condition. -```typescript -// Find documents where the 'completed' field is NOT true -not(equal("completed", true)); - -``` - Signature: ```typescript @@ -2495,12 +1162,23 @@ export declare function not(booleanExpr: BooleanExpression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| booleanExpr | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The filter condition to negate. A new representing the negated filter condition. | +| booleanExpr | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The filter condition to negate. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the negated filter condition. + +### Example + + +```typescript +// Find documents where the 'completed' field is NOT true +not(equal("completed", true)); + +``` + ## function(condition, ...) ### conditional(condition, thenExpr, elseExpr) {:#conditional_07a206d} @@ -2510,13 +1188,6 @@ export declare function not(booleanExpr: BooleanExpression): BooleanExpression; Creates a conditional expression that evaluates to a 'then' expression if a condition is true and an 'else' expression if the condition is false. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -conditional( - greaterThan("age", 18), constant("Adult"), constant("Minor")); - -``` - Signature: ```typescript @@ -2529,12 +1200,24 @@ export declare function conditional(condition: BooleanExpression, thenExpr: Expr | --- | --- | --- | | condition | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The condition to evaluate. | | thenExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is true. | -| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. A new representing the conditional expression. | +| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the conditional expression. + +### Example + + +```typescript +// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". +conditional( + greaterThan("age", 18), constant("Adult"), constant("Minor")); + +``` + ## function(documentPath, ...) ### documentId(documentPath) {:#documentid_cef293c} @@ -2544,13 +1227,6 @@ export declare function conditional(condition: BooleanExpression, thenExpr: Expr Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(myDocumentReference); - -``` - A new representing the documentId operation. - Signature: ```typescript @@ -2567,6 +1243,17 @@ export declare function documentId(documentPath: string | DocumentReference): Fu [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the documentId operation. + +### Example + + +```typescript +// Get the document ID from a path. +documentId(myDocumentReference); + +``` + ## function(documentPathExpr, ...) ### documentId(documentPathExpr) {:#documentid_9a69021} @@ -2576,13 +1263,6 @@ export declare function documentId(documentPath: string | DocumentReference): Fu Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(field("__path__")); - -``` - A new representing the documentId operation. - Signature: ```typescript @@ -2599,6 +1279,17 @@ export declare function documentId(documentPathExpr: Expression): FunctionExpres [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the documentId operation. + +### Example + + +```typescript +// Get the document ID from a path. +documentId(field("__path__")); + +``` + ## function(element, ...) ### notEqualAny(element, values) {:#notequalany_c2c5bcb} @@ -2608,12 +1299,6 @@ export declare function documentId(documentPathExpr: Expression): FunctionExpres Creates an expression that checks if an expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -notEqualAny(field("status"), ["pending", field("rejectedStatus")]); - -``` - Signature: ```typescript @@ -2625,25 +1310,30 @@ export declare function notEqualAny(element: Expression, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### notEqualAny(element, arrayExpression) {:#notequalany_16b2851} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is not equal to any of the provided values or expressions. ```typescript -// Check if the 'status' field is neither "pending" nor the value of the field 'rejectedStatus' +// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' notEqualAny(field("status"), ["pending", field("rejectedStatus")]); ``` +### notEqualAny(element, arrayExpression) {:#notequalany_16b2851} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is not equal to any of the provided values or expressions. + Signature: ```typescript @@ -2655,12 +1345,23 @@ export declare function notEqualAny(element: Expression, arrayExpression: Expres | Parameter | Type | Description | | --- | --- | --- | | element | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The values to check against. A new representing the 'NOT IN' comparison. | +| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The values to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. + +### Example + + +```typescript +// Check if the 'status' field is neither "pending" nor the value of the field 'rejectedStatus' +notEqualAny(field("status"), ["pending", field("rejectedStatus")]); + +``` + ## function(elements, ...) ### array(elements) {:#array_7d853aa} @@ -2670,12 +1371,6 @@ export declare function notEqualAny(element: Expression, arrayExpression: Expres Creates an expression that creates a Firestore array value from an input array. -```typescript -// Create an array value from the input array and reference the 'baz' field value from the input document. -array(['bar', Field.of('baz')]).as('foo'); - -``` - Signature: ```typescript @@ -2686,25 +1381,30 @@ export declare function array(elements: unknown[]): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| elements | unknown\[\] | The input array to evaluate in the expression. A new representing the array function. | +| elements | unknown\[\] | The input array to evaluate in the expression. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### map(elements) {:#map_ce5dee1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the array function. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that creates a Firestore map value from an input object. ```typescript -// Create a map from the input object and reference the 'baz' field value from the input document. -map({foo: 'bar', baz: Field.of('baz')}).as('data'); +// Create an array value from the input array and reference the 'baz' field value from the input document. +array(['bar', Field.of('baz')]).as('foo'); ``` +### map(elements) {:#map_ce5dee1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that creates a Firestore map value from an input object. + Signature: ```typescript @@ -2715,12 +1415,23 @@ export declare function map(elements: Record): FunctionExpressi | Parameter | Type | Description | | --- | --- | --- | -| elements | Record<string, unknown> | The input map to evaluate in the expression. A new representing the map function. | +| elements | Record<string, unknown> | The input map to evaluate in the expression. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the map function. + +### Example + + +```typescript +// Create a map from the input object and reference the 'baz' field value from the input document. +map({foo: 'bar', baz: Field.of('baz')}).as('data'); + +``` + ## function(expr, ...) ### abs(expr) {:#abs_005f3d4} @@ -2740,25 +1451,20 @@ export declare function abs(expr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compute the absolute value of. A new representing the absolute value of the numeric value. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compute the absolute value of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the absolute value of the numeric value. + ### ascending(expr) {:#ascending_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an that sorts documents in ascending order based on an expression. - -```typescript -// Sort documents by the 'name' field in lowercase in ascending order -firestore.pipeline().collection("users") - .sort(ascending(field("name").toLower())); - -``` +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on an expression. Signature: @@ -2770,25 +1476,31 @@ export declare function ascending(expr: Expression): Ordering; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to create an ascending ordering for. A new Ordering for ascending sorting. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to create an ascending ordering for. | Returns: [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) -### byteLength(expr) {:#bytelength_005f3d4} +A new `Ordering` for ascending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. ```typescript -// Calculate the length of the 'myString' field in bytes. -byteLength(field("myString")); +// Sort documents by the 'name' field in lowercase in ascending order +firestore.pipeline().collection("users") + .sort(ascending(field("name").toLower())); ``` +### byteLength(expr) {:#bytelength_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. + Signature: ```typescript @@ -2799,12 +1511,23 @@ export declare function byteLength(expr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string. A new representing the length of the string in bytes. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string in bytes. + +### Example + + +```typescript +// Calculate the length of the 'myString' field in bytes. +byteLength(field("myString")); + +``` + ### countDistinct(expr) {:#countdistinct_3c28b08} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2822,25 +1545,20 @@ export declare function countDistinct(expr: Expression | string): AggregateFunct | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string | The expression or field to count distinct values of. A new AggregateFunction representing the 'count\_distinct' aggregation. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string | The expression or field to count distinct values of. | Returns: [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +A new `AggregateFunction` representing the 'count\_distinct' aggregation. + ### descending(expr) {:#descending_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an that sorts documents in descending order based on an expression. - -```typescript -// Sort documents by the 'name' field in lowercase in descending order -firestore.pipeline().collection("users") - .sort(descending(field("name").toLower())); - -``` +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on an expression. Signature: @@ -2852,12 +1570,24 @@ export declare function descending(expr: Expression): Ordering; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to create a descending ordering for. A new Ordering for descending sorting. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to create a descending ordering for. | Returns: [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) +A new `Ordering` for descending sorting. + +### Example + + +```typescript +// Sort documents by the 'name' field in lowercase in descending order +firestore.pipeline().collection("users") + .sort(descending(field("name").toLower())); + +``` + ### floor(expr) {:#floor_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2875,12 +1605,14 @@ export declare function floor(expr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compute the floor of. A new representing the floor of the numeric value. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compute the floor of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the floor of the numeric value. + ### timestampToUnixMicros(expr) {:#timestamptounixmicros_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2888,34 +1620,60 @@ export declare function floor(expr: Expression): FunctionExpression; Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). +Signature: + +```typescript +export declare function timestampToUnixMicros(expr: Expression): FunctionExpression; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. | + +Returns: + +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of microseconds since epoch. + +### Example + + ```typescript // Convert the 'timestamp' field to microseconds since epoch. timestampToUnixMicros(field("timestamp")); ``` +### timestampToUnixMillis(expr) {:#timestamptounixmillis_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript -export declare function timestampToUnixMicros(expr: Expression): FunctionExpression; +export declare function timestampToUnixMillis(expr: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. A new representing the number of microseconds since epoch. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixMillis(expr) {:#timestamptounixmillis_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of milliseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript // Convert the 'timestamp' field to milliseconds since epoch. @@ -2923,28 +1681,33 @@ timestampToUnixMillis(field("timestamp")); ``` +### timestampToUnixSeconds(expr) {:#timestamptounixseconds_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript -export declare function timestampToUnixMillis(expr: Expression): FunctionExpression; +export declare function timestampToUnixSeconds(expr: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. A new representing the number of milliseconds since epoch. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixSeconds(expr) {:#timestamptounixseconds_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of seconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript // Convert the 'timestamp' field to seconds since epoch. @@ -2952,28 +1715,33 @@ timestampToUnixSeconds(field("timestamp")); ``` +### unixMicrosToTimestamp(expr) {:#unixmicrostotimestamp_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript -export declare function timestampToUnixSeconds(expr: Expression): FunctionExpression; +export declare function unixMicrosToTimestamp(expr: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. A new representing the number of seconds since epoch. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of microseconds since epoch. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### unixMicrosToTimestamp(expr) {:#unixmicrostotimestamp_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript // Interpret the 'microseconds' field as microseconds since epoch. @@ -2981,28 +1749,33 @@ unixMicrosToTimestamp(field("microseconds")); ``` +### unixMillisToTimestamp(expr) {:#unixmillistotimestamp_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript -export declare function unixMicrosToTimestamp(expr: Expression): FunctionExpression; +export declare function unixMillisToTimestamp(expr: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of microseconds since epoch. A new representing the timestamp. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of milliseconds since epoch. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### unixMillisToTimestamp(expr) {:#unixmillistotimestamp_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript // Interpret the 'milliseconds' field as milliseconds since epoch. @@ -3010,28 +1783,33 @@ unixMillisToTimestamp(field("milliseconds")); ``` +### unixSecondsToTimestamp(expr) {:#unixsecondstotimestamp_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript -export declare function unixMillisToTimestamp(expr: Expression): FunctionExpression; +export declare function unixSecondsToTimestamp(expr: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of milliseconds since epoch. A new representing the timestamp. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of seconds since epoch. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### unixSecondsToTimestamp(expr) {:#unixsecondstotimestamp_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript // Interpret the 'seconds' field as seconds since epoch. @@ -3039,30 +1817,35 @@ unixSecondsToTimestamp(field("seconds")); ``` +## function(expression, ...) + +### arraySum(expression) {:#arraysum_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the sum of the elements in an array. + Signature: ```typescript -export declare function unixSecondsToTimestamp(expr: Expression): FunctionExpression; +export declare function arraySum(expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the number of seconds since epoch. A new representing the timestamp. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric array, which the sum will be computed for. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -## function(expression, ...) - -### arraySum(expression) {:#arraysum_1138a27} +A new `Expression` representing the sum of the elements in the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the sum of the elements in an array. ```typescript // Compute the sum of the elements in the 'scores' field. @@ -3070,28 +1853,33 @@ arraySum(field("scores")); ``` +### average(expression) {:#average_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. + Signature: ```typescript -export declare function arraySum(expression: Expression): FunctionExpression; +export declare function average(expression: Expression): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric array, which the sum will be computed for. A new Expr representing the sum of the elements in the array. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the values to average. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### average(expression) {:#average_1138a27} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'average' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. ```typescript // Calculate the average age of users @@ -3099,28 +1887,33 @@ average(field("age")).as("averageAge"); ``` +### ceil(expression) {:#ceil_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the ceiling of a numeric value. + Signature: ```typescript -export declare function average(expression: Expression): AggregateFunction; +export declare function ceil(expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the values to average. A new representing the 'average' aggregation. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the ceiling will be computed for. | Returns: -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### ceil(expression) {:#ceil_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the ceiling of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the ceiling of a numeric value. ```typescript // Compute the ceiling of the 'price' field. @@ -3128,28 +1921,33 @@ ceil(field("price")); ``` +### collectionId(expression) {:#collectionid_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the collection ID from a path. + Signature: ```typescript -export declare function ceil(expression: Expression): FunctionExpression; +export declare function collectionId(expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the ceiling will be computed for. A new representing the ceiling of the numeric value. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a path, which the collection ID will be extracted from. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### collectionId(expression) {:#collectionid_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the collectionId operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the collection ID from a path. ```typescript // Get the collection ID from a path. @@ -3157,28 +1955,33 @@ collectionId(field("__name__")); ``` +### count(expression) {:#count_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. + Signature: ```typescript -export declare function collectionId(expression: Expression): FunctionExpression; +export declare function count(expression: Expression): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a path, which the collection ID will be extracted from. A new representing the collectionId operation. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to count. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### count(expression) {:#count_1138a27} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'count' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. ```typescript // Count the number of items where the price is greater than 10 @@ -3186,28 +1989,34 @@ count(field("price").greaterThan(10)).as("expensiveItemCount"); ``` +### divide(expression, value) {:#divide_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides an expression by a constant value. + Signature: ```typescript -export declare function count(expression: Expression): AggregateFunction; +export declare function divide(expression: Expression, value: unknown): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to count. A new representing the 'count' aggregation. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to be divided. | +| value | unknown | The constant value to divide by. | Returns: -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### divide(expression, value) {:#divide_01df3cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides an expression by a constant value. ```typescript // Divide the 'value' field by 10 @@ -3215,29 +2024,34 @@ divide(field("value"), 10); ``` +### equal(expression, value) {:#equal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is equal to a constant value. + Signature: ```typescript -export declare function divide(expression: Expression, value: unknown): FunctionExpression; +export declare function equal(expression: Expression, value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to be divided. | -| value | unknown | The constant value to divide by. A new representing the division operation. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | +| value | unknown | The constant value to compare to. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### equal(expression, value) {:#equal_01df3cf} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is equal to a constant value. ```typescript // Check if the 'age' field is equal to 21 @@ -3245,29 +2059,34 @@ equal(field("age"), 21); ``` +### equalAny(expression, values) {:#equalany_7e759b5} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. + Signature: ```typescript -export declare function equal(expression: Expression, value: unknown): BooleanExpression; +export declare function equalAny(expression: Expression, values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the equality comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression whose results to compare. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The values to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(expression, values) {:#equalany_7e759b5} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -3275,10 +2094,17 @@ equalAny(field("category"), [constant("Electronics"), field("primaryType")]); ``` +### equalAny(expression, arrayExpression) {:#equalany_214ce68} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is equal to any of the provided values. + Signature: ```typescript -export declare function equalAny(expression: Expression, values: Array): BooleanExpression; +export declare function equalAny(expression: Expression, arrayExpression: Expression): BooleanExpression; ``` #### Parameters @@ -3286,18 +2112,16 @@ export declare function equalAny(expression: Expression, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(expression, arrayExpression) {:#equalany_214ce68} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is equal to any of the provided values. ```typescript // Check if the 'category' field is set to a value in the disabledCategories field @@ -3305,59 +2129,68 @@ equalAny(field("category"), field('disabledCategories')); ``` +### exp(expression) {:#exp_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes e to the power of the expression's result. + Signature: ```typescript -export declare function equalAny(expression: Expression, arrayExpression: Expression): BooleanExpression; +export declare function exp(expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression whose results to compare. | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for equality to the input. A new representing the 'IN' comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### exp(expression) {:#exp_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the exp of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes e to the power of the expression's result. ```typescript // Compute e to the power of 2. exp(constant(2)); ``` - A new representing the exp of the numeric value. + +### greaterThan(expression, value) {:#greaterthan_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is greater than a constant value. Signature: ```typescript -export declare function exp(expression: Expression): FunctionExpression; +export declare function greaterThan(expression: Expression, value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | +| value | unknown | The constant value to compare to. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThan(expression, value) {:#greaterthan_01df3cf} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is greater than a constant value. ```typescript // Check if the 'age' field is greater than 18 @@ -3365,10 +2198,17 @@ greaterThan(field("age"), 18); ``` +### greaterThanOrEqual(expression, value) {:#greaterthanorequal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is greater than or equal to a constant value. + Signature: ```typescript -export declare function greaterThan(expression: Expression, value: unknown): BooleanExpression; +export declare function greaterThanOrEqual(expression: Expression, value: unknown): BooleanExpression; ``` #### Parameters @@ -3376,18 +2216,16 @@ export declare function greaterThan(expression: Expression, value: unknown): Boo | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(expression, value) {:#greaterthanorequal_01df3cf} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is greater than or equal to a constant value. ```typescript // Check if the 'quantity' field is greater than or equal to 10 @@ -3395,29 +2233,33 @@ greaterThanOrEqual(field("quantity"), 10); ``` +### length\_2(expression) {:#length_2_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string, array, map, vector, or bytes. + Signature: ```typescript -export declare function greaterThanOrEqual(expression: Expression, value: unknown): BooleanExpression; +declare function length_2(expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than or equal to comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a string, array, map, vector, or bytes, which the length will be calculated for. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### length\_2(expression) {:#length_2_1138a27} +A new `Expression` representing the length of the string, array, map, vector, or bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string, array, map, vector, or bytes. ```typescript // Get the length of the 'name' field. @@ -3428,28 +2270,34 @@ length(field("cart")); ``` +### lessThan(expression, value) {:#lessthan_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is less than a constant value. + Signature: ```typescript -declare function length_2(expression: Expression): FunctionExpression; +export declare function lessThan(expression: Expression, value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a string, array, map, vector, or bytes, which the length will be calculated for. A new Expr representing the length of the string, array, map, vector, or bytes. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | +| value | unknown | The constant value to compare to. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThan(expression, value) {:#lessthan_01df3cf} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is less than a constant value. ```typescript // Check if the 'age' field is less than 30 @@ -3457,10 +2305,17 @@ lessThan(field("age"), 30); ``` +### lessThanOrEqual(expression, value) {:#lessthanorequal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is less than or equal to a constant value. + Signature: ```typescript -export declare function lessThan(expression: Expression, value: unknown): BooleanExpression; +export declare function lessThanOrEqual(expression: Expression, value: unknown): BooleanExpression; ``` #### Parameters @@ -3468,18 +2323,16 @@ export declare function lessThan(expression: Expression, value: unknown): Boolea | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(expression, value) {:#lessthanorequal_01df3cf} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is less than or equal to a constant value. ```typescript // Check if the 'quantity' field is less than or equal to 20 @@ -3487,29 +2340,33 @@ lessThan(field("quantity"), 20); ``` +### ln(expression) {:#ln_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the natural logarithm of a numeric value. + Signature: ```typescript -export declare function lessThanOrEqual(expression: Expression, value: unknown): BooleanExpression; +export declare function ln(expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than or equal to comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the natural logarithm will be computed for. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### ln(expression) {:#ln_1138a27} +A new `Expression` representing the natural logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the natural logarithm of a numeric value. ```typescript // Compute the natural logarithm of the 'value' field. @@ -3517,39 +2374,52 @@ ln(field("value")); ``` +### log(expression, base) {:#log_ac183e2} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of an expression to a given base. + Signature: ```typescript -export declare function ln(expression: Expression): FunctionExpression; +export declare function log(expression: Expression, base: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the natural logarithm will be computed for. A new Expr representing the natural logarithm of the numeric value. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the logarithm will be computed for. | +| base | number | The base of the logarithm. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### log(expression, base) {:#log_ac183e2} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of an expression to a given base. ```typescript // Compute the logarithm of the 'value' field with base 10. log(field("value"), 10); -``` +``` + +### log(expression, base) {:#log_1894737} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of an expression to a given base. Signature: ```typescript -export declare function log(expression: Expression, base: number): FunctionExpression; +export declare function log(expression: Expression, base: Expression): FunctionExpression; ``` #### Parameters @@ -3557,18 +2427,16 @@ export declare function log(expression: Expression, base: number): FunctionExpre | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the logarithm will be computed for. | -| base | number | The base of the logarithm. A new representing the logarithm of the numeric value. | +| base | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The base of the logarithm. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### log(expression, base) {:#log_1894737} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of an expression to a given base. ```typescript // Compute the logarithm of the 'value' field with the base in the 'base' field. @@ -3576,29 +2444,33 @@ log(field("value"), field("base")); ``` +### log10(expression) {:#log10_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the base-10 logarithm of a numeric value. + Signature: ```typescript -export declare function log(expression: Expression, base: Expression): FunctionExpression; +export declare function log10(expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the logarithm will be computed for. | -| base | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The base of the logarithm. A new representing the logarithm of the numeric value. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the base-10 logarithm will be computed for. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### log10(expression) {:#log10_1138a27} +A new `Expression` representing the base-10 logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the base-10 logarithm of a numeric value. ```typescript // Compute the base-10 logarithm of the 'value' field. @@ -3606,28 +2478,33 @@ log10(field("value")); ``` +### maximum(expression) {:#maximum_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the maximum value of an expression across multiple stage inputs. + Signature: ```typescript -export declare function log10(expression: Expression): FunctionExpression; +export declare function maximum(expression: Expression): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the base-10 logarithm will be computed for. A new Expr representing the base-10 logarithm of the numeric value. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to find the maximum value of. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### maximum(expression) {:#maximum_1138a27} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'maximum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the maximum value of an expression across multiple stage inputs. ```typescript // Find the highest score in a leaderboard @@ -3635,28 +2512,33 @@ maximum(field("score")).as("highestScore"); ``` +### minimum(expression) {:#minimum_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. + Signature: ```typescript -export declare function maximum(expression: Expression): AggregateFunction; +export declare function minimum(expression: Expression): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to find the maximum value of. A new representing the 'maximum' aggregation. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to find the minimum value of. | Returns: [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### minimum(expression) {:#minimum_1138a27} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'minimum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. ```typescript // Find the lowest price of all products @@ -3664,22 +2546,6 @@ minimum(field("price")).as("lowestPrice"); ``` -Signature: - -```typescript -export declare function minimum(expression: Expression): AggregateFunction; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to find the minimum value of. A new representing the 'minimum' aggregation. | - -Returns: - -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) - ### mod(expression, value) {:#mod_01df3cf} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3687,12 +2553,6 @@ export declare function minimum(expression: Expression): AggregateFunction; Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. -```typescript -// Calculate the remainder of dividing 'field1' by 5. -mod(field("field1"), 5); - -``` - Signature: ```typescript @@ -3704,25 +2564,30 @@ export declare function mod(expression: Expression, value: unknown): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The dividend expression. | -| value | unknown | The divisor constant. A new representing the modulo operation. | +| value | unknown | The divisor constant. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### notEqual(expression, value) {:#notequal_01df3cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is not equal to a constant value. ```typescript -// Check if the 'status' field is not equal to "completed" -notEqual(field("status"), "completed"); +// Calculate the remainder of dividing 'field1' by 5. +mod(field("field1"), 5); ``` +### notEqual(expression, value) {:#notequal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is not equal to a constant value. + Signature: ```typescript @@ -3734,25 +2599,30 @@ export declare function notEqual(expression: Expression, value: unknown): Boolea | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the inequality comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### round(expression) {:#round_1138a27} +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the nearest whole number. ```typescript -// Round the value of the 'price' field. -round(field("price")); +// Check if the 'status' field is not equal to "completed" +notEqual(field("status"), "completed"); ``` +### round(expression) {:#round_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the nearest whole number. + Signature: ```typescript @@ -3763,25 +2633,30 @@ export declare function round(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which will be rounded. A new Expr representing the rounded value. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which will be rounded. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### round(expression, decimalPlaces) {:#round_a3a92d0} +A new `Expression` representing the rounded value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the specified number of decimal places. ```typescript -// Round the value of the 'price' field to two decimal places. -round(field("price"), constant(2)); +// Round the value of the 'price' field. +round(field("price")); ``` +### round(expression, decimalPlaces) {:#round_a3a92d0} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the specified number of decimal places. + Signature: ```typescript @@ -3793,12 +2668,23 @@ export declare function round(expression: Expression, decimalPlaces: number | Ex | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which will be rounded. | -| decimalPlaces | number \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | number \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the rounded value. + +### Example + + +```typescript +// Round the value of the 'price' field to two decimal places. +round(field("price"), constant(2)); + +``` + ### split(expression, delimiter) {:#split_5b5612b} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3817,12 +2703,14 @@ export declare function split(expression: Expression, delimiter: string): Functi | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Split the result of this expression. | -| delimiter | string | Split on this delimiter. A new representing the split function. | +| delimiter | string | Split on this delimiter. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3850,12 +2738,14 @@ export declare function split(expression: Expression, delimiter: Expression): Fu | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Split the result of this expression. | -| delimiter | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. A new representing the split function. | +| delimiter | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3872,12 +2762,6 @@ split(field('scores'), conditional(field('format').equal('csv'), constant(','), Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt(field("value")); - -``` - Signature: ```typescript @@ -3888,25 +2772,30 @@ export declare function sqrt(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the square root will be computed for. A new representing the square root of the numeric value. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the square root will be computed for. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### subtract(expression, value) {:#subtract_01df3cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the square root of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a constant value from an expression. ```typescript -// Subtract the constant value 2 from the 'value' field -subtract(field("value"), 2); +// Compute the square root of the 'value' field. +sqrt(field("value")); ``` +### subtract(expression, value) {:#subtract_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a constant value from an expression. + Signature: ```typescript @@ -3918,25 +2807,30 @@ export declare function subtract(expression: Expression, value: unknown): Functi | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract from. | -| value | unknown | The constant value to subtract. A new representing the subtraction operation. | +| value | unknown | The constant value to subtract. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### sum(expression) {:#sum_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. ```typescript -// Calculate the total revenue from a set of orders -sum(field("orderAmount")).as("totalRevenue"); +// Subtract the constant value 2 from the 'value' field +subtract(field("value"), 2); ``` +### sum(expression) {:#sum_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. + Signature: ```typescript @@ -3947,12 +2841,23 @@ export declare function sum(expression: Expression): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to sum up. A new representing the 'sum' aggregation. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to sum up. | Returns: [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'sum' aggregation. + +### Example + + +```typescript +// Calculate the total revenue from a set of orders +sum(field("orderAmount")).as("totalRevenue"); + +``` + ### type(expression) {:#type_1138a27} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3976,6 +2881,8 @@ export declare function type(expression: Expression): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the data type. + ### Example @@ -3984,7 +2891,6 @@ export declare function type(expression: Expression): FunctionExpression; type(conditional(exists('foo'), constant(1), constant(true))) ``` - A new {Expression} representing the data type. ## function(field, ...) @@ -3995,12 +2901,6 @@ type(conditional(exists('foo'), constant(1), constant(true))) Creates an expression that returns `true` if a field is absent. Otherwise, returns `false` even if the field value is `null`. -```typescript -// Check if the field `value` is absent. -isAbsent("value"); - -``` - Signature: ```typescript @@ -4011,25 +2911,30 @@ export declare function isAbsent(field: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| field | string | The field to check. A new representing the 'isAbsent' check. | +| field | string | The field to check. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### reverse(field) {:#reverse_0fb8cd4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'isAbsent' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string value in the specified field. ```typescript -// Reverse the value of the 'myString' field. -reverse("myString"); +// Check if the field `value` is absent. +isAbsent("value"); ``` +### reverse(field) {:#reverse_0fb8cd4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string value in the specified field. + Signature: ```typescript @@ -4040,25 +2945,30 @@ export declare function reverse(field: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| field | string | The name of the field representing the string to reverse. A new representing the reversed string. | +| field | string | The name of the field representing the string to reverse. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### stringReverse(field) {:#stringreverse_0fb8cd4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string value in the specified field. ```typescript // Reverse the value of the 'myString' field. -strReverse("myString"); +reverse("myString"); ``` +### stringReverse(field) {:#stringreverse_0fb8cd4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string value in the specified field. + Signature: ```typescript @@ -4069,12 +2979,23 @@ export declare function stringReverse(field: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| field | string | The name of the field representing the string to reverse. A new representing the reversed string. | +| field | string | The name of the field representing the string to reverse. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. + +### Example + + +```typescript +// Reverse the value of the 'myString' field. +strReverse("myString"); + +``` + ### substring(field, position, length) {:#substring_0d9573a} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -4144,18 +3065,42 @@ export declare function abs(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to compute the absolute value of. A new representing the absolute value of the numeric value. | +| fieldName | string | The field to compute the absolute value of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the absolute value of the numeric value. + ### add(fieldName, second) {:#add_b75bb8b} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an expression that adds a field's value to an expression. +Creates an expression that adds a field's value to an expression. + +Signature: + +```typescript +export declare function add(fieldName: string, second: Expression | unknown): FunctionExpression; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | The name of the field containing the value to add. | +| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal to add. | + +Returns: + +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the addition operation. + +### Example + ```typescript // Add the value of the 'quantity' field and the 'reserve' field. @@ -4163,29 +3108,34 @@ add("quantity", field("reserve")); ``` +### arrayContains(fieldName, element) {:#arraycontains_aaace4a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains a specific element. + Signature: ```typescript -export declare function add(fieldName: string, second: Expression | unknown): FunctionExpression; +export declare function arrayContains(fieldName: string, element: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the value to add. | -| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal to add. | +| fieldName | string | The field name to check. | +| element | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The element to search for in the array. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContains(fieldName, element) {:#arraycontains_aaace4a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains a specific element. ```typescript // Check if the 'colors' array contains the value of field 'selectedColor' @@ -4193,10 +3143,17 @@ arrayContains("colors", field("selectedColor")); ``` +### arrayContains(fieldName, element) {:#arraycontains_999590f} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains a specific value. + Signature: ```typescript -export declare function arrayContains(fieldName: string, element: Expression): BooleanExpression; +export declare function arrayContains(fieldName: string, element: unknown): BooleanExpression; ``` #### Parameters @@ -4204,18 +3161,16 @@ export declare function arrayContains(fieldName: string, element: Expression): B | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| element | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| element | unknown | The element to search for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContains(fieldName, element) {:#arraycontains_999590f} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains a specific value. ```typescript // Check if the 'colors' array contains "red" @@ -4223,10 +3178,17 @@ arrayContains("colors", "red"); ``` +### arrayContainsAll(fieldName, values) {:#arraycontainsall_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains all the specified values or expressions. + Signature: ```typescript -export declare function arrayContains(fieldName: string, element: unknown): BooleanExpression; +export declare function arrayContainsAll(fieldName: string, values: Array): BooleanExpression; ``` #### Parameters @@ -4234,18 +3196,16 @@ export declare function arrayContains(fieldName: string, element: unknown): Bool | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| element | unknown | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(fieldName, values) {:#arraycontainsall_8060b23} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains all the specified values or expressions. ```typescript // Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" @@ -4253,10 +3213,17 @@ arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); ``` +### arrayContainsAll(fieldName, arrayExpression) {:#arraycontainsall_48da8d9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains all the specified values or expressions. + Signature: ```typescript -export declare function arrayContainsAll(fieldName: string, values: Array): BooleanExpression; +export declare function arrayContainsAll(fieldName: string, arrayExpression: Expression): BooleanExpression; ``` #### Parameters @@ -4264,18 +3231,16 @@ export declare function arrayContainsAll(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(fieldName, arrayExpression) {:#arraycontainsall_48da8d9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains all the specified values or expressions. ```typescript // Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" @@ -4283,10 +3248,17 @@ arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); ``` +### arrayContainsAny(fieldName, values) {:#arraycontainsany_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains any of the specified elements. + Signature: ```typescript -export declare function arrayContainsAll(fieldName: string, arrayExpression: Expression): BooleanExpression; +export declare function arrayContainsAny(fieldName: string, values: Array): BooleanExpression; ``` #### Parameters @@ -4294,18 +3266,16 @@ export declare function arrayContainsAll(fieldName: string, arrayExpression: Exp | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The elements to check for in the array. A new representing the 'array\_contains\_all' comparison. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(fieldName, values) {:#arraycontainsany_8060b23} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains any of the specified elements. ```typescript // Check if the 'groups' array contains either the value from the 'userGroup' field @@ -4314,10 +3284,17 @@ arrayContainsAny("categories", [field("cate1"), "Science"]); ``` +### arrayContainsAny(fieldName, values) {:#arraycontainsany_1b4f7cd} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains any of the specified elements. + Signature: ```typescript -export declare function arrayContainsAny(fieldName: string, values: Array): BooleanExpression; +export declare function arrayContainsAny(fieldName: string, values: Expression): BooleanExpression; ``` #### Parameters @@ -4325,18 +3302,16 @@ export declare function arrayContainsAny(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(fieldName, values) {:#arraycontainsany_1b4f7cd} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains any of the specified elements. ```typescript // Check if the 'groups' array contains either the value from the 'userGroup' field @@ -4345,29 +3320,33 @@ arrayContainsAny("categories", array([field("cate1"), "Science"])); ``` +### arrayLength(fieldName) {:#arraylength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of an array in a specified field. + Signature: ```typescript -export declare function arrayContainsAny(fieldName: string, values: Expression): BooleanExpression; +export declare function arrayLength(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to check. | -| values | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for in the array field. A new representing the 'array\_contains\_any' comparison. | +| fieldName | string | The name of the field containing an array to calculate the length of. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### arrayLength(fieldName) {:#arraylength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of an array in a specified field. ```typescript // Get the number of items in field 'cart' @@ -4375,28 +3354,33 @@ arrayLength('cart'); ``` +### arraySum(fieldName) {:#arraysum_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the sum of the elements in an array. + Signature: ```typescript -export declare function arrayLength(fieldName: string): FunctionExpression; +export declare function arraySum(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing an array to calculate the length of. A new representing the length of the array. | +| fieldName | string | The name of the field to compute the sum of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### arraySum(fieldName) {:#arraysum_e5b0480} +A new `Expression` representing the sum of the elements in the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the sum of the elements in an array. ```typescript // Compute the sum of the elements in the 'scores' field. @@ -4404,28 +3388,33 @@ arraySum("scores"); ``` +### ascending(fieldName) {:#ascending_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on a field. + Signature: ```typescript -export declare function arraySum(fieldName: string): FunctionExpression; +export declare function ascending(fieldName: string): Ordering; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the sum of. A new Expr representing the sum of the elements in the array. | +| fieldName | string | The field to create an ascending ordering for. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) -### ascending(fieldName) {:#ascending_e5b0480} +A new `Ordering` for ascending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an that sorts documents in ascending order based on a field. ```typescript // Sort documents by the 'name' field in ascending order @@ -4434,28 +3423,33 @@ firestore.pipeline().collection("users") ``` +### average(fieldName) {:#average_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. + Signature: ```typescript -export declare function ascending(fieldName: string): Ordering; +export declare function average(fieldName: string): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to create an ascending ordering for. A new Ordering for ascending sorting. | +| fieldName | string | The name of the field containing numeric values to average. | Returns: -[Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### average(fieldName) {:#average_e5b0480} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'average' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. ```typescript // Calculate the average age of users @@ -4463,28 +3457,33 @@ average("age").as("averageAge"); ``` +### byteLength(fieldName) {:#bytelength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. + Signature: ```typescript -export declare function average(fieldName: string): AggregateFunction; +export declare function byteLength(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing numeric values to average. A new representing the 'average' aggregation. | +| fieldName | string | The name of the field containing the string. | Returns: -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### byteLength(fieldName) {:#bytelength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string in bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. ```typescript // Calculate the length of the 'myString' field in bytes. @@ -4492,28 +3491,33 @@ byteLength("myString"); ``` +### ceil(fieldName) {:#ceil_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the ceiling of a numeric value. + Signature: ```typescript -export declare function byteLength(fieldName: string): FunctionExpression; +export declare function ceil(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the length of the string in bytes. | +| fieldName | string | The name of the field to compute the ceiling of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### ceil(fieldName) {:#ceil_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the ceiling of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the ceiling of a numeric value. ```typescript // Compute the ceiling of the 'price' field. @@ -4521,28 +3525,33 @@ ceil("price"); ``` +### charLength(fieldName) {:#charlength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the character length of a string field in UTF8. + Signature: ```typescript -export declare function ceil(fieldName: string): FunctionExpression; +export declare function charLength(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the ceiling of. A new representing the ceiling of the numeric value. | +| fieldName | string | The name of the field containing the string. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### charLength(fieldName) {:#charlength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the character length of a string field in UTF8. ```typescript // Get the character length of the 'name' field in UTF-8. @@ -4550,28 +3559,33 @@ strLength("name"); ``` +### collectionId(fieldName) {:#collectionid_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the collection ID from a path. + Signature: ```typescript -export declare function charLength(fieldName: string): FunctionExpression; +export declare function collectionId(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the length of the string. | +| fieldName | string | The name of the field to get the collection ID from. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### collectionId(fieldName) {:#collectionid_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the collectionId operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the collection ID from a path. ```typescript // Get the collection ID from a path. @@ -4579,28 +3593,35 @@ collectionId("__name__"); ``` +### concat(fieldName, second, others) {:#concat_828272e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. + Signature: ```typescript -export declare function collectionId(fieldName: string): FunctionExpression; +export declare function concat(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to get the collection ID from. A new representing the collectionId operation. | +| fieldName | string | The name of a field to concatenate. | +| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second literal or expression to concatenate. | +| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Additional literal or expressions to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### concat(fieldName, second, others) {:#concat_828272e} +A new `Expression` representing the concatenation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. ```typescript // Concatenate a field with a literal string. @@ -4608,30 +3629,34 @@ concat(field("firstName"), "Doe") ``` +### cosineDistance(fieldName, vector) {:#cosinedistance_463a23e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between a field's vector value and a literal vector value. + Signature: ```typescript -export declare function concat(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; +export declare function cosineDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of a field to concatenate. | -| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second literal or expression to concatenate. | -| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Additional literal or expressions to concatenate. A new Expression representing the concatenation. | +| fieldName | string | The name of the field containing the first vector. | +| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles) or [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### cosineDistance(fieldName, vector) {:#cosinedistance_463a23e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between a field's vector value and a literal vector value. ```typescript // Calculate the Cosine distance between the 'location' field and a target location @@ -4639,10 +3664,17 @@ cosineDistance("location", [37.7749, -122.4194]); ``` +### cosineDistance(fieldName, vectorExpression) {:#cosinedistance_ed766a1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between a field's vector value and a vector expression. + Signature: ```typescript -export declare function cosineDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; +export declare function cosineDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; ``` #### Parameters @@ -4650,18 +3682,16 @@ export declare function cosineDistance(fieldName: string, vector: number[] | Vec | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the first vector. | -| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles) or [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) to compare against. A new representing the Cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### cosineDistance(fieldName, vectorExpression) {:#cosinedistance_ed766a1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between a field's vector value and a vector expression. ```typescript // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field @@ -4669,29 +3699,33 @@ cosineDistance("userVector", field("itemVector")); ``` +### count(fieldName) {:#count_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of stage inputs where the input field exists. + Signature: ```typescript -export declare function cosineDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; +export declare function count(fieldName: string): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the first vector. | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the cosine distance between the two vectors. | +| fieldName | string | The name of the field to count. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### count(fieldName) {:#count_e5b0480} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'count' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of stage inputs where the input field exists. ```typescript // Count the total number of products @@ -4699,28 +3733,33 @@ count("productId").as("totalProducts"); ``` +### descending(fieldName) {:#descending_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on a field. + Signature: ```typescript -export declare function count(fieldName: string): AggregateFunction; +export declare function descending(fieldName: string): Ordering; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to count. A new representing the 'count' aggregation. | +| fieldName | string | The field to create a descending ordering for. | Returns: -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +[Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) -### descending(fieldName) {:#descending_e5b0480} +A new `Ordering` for descending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an that sorts documents in descending order based on a field. ```typescript // Sort documents by the 'name' field in descending order @@ -4729,28 +3768,34 @@ firestore.pipeline().collection("users") ``` +### divide(fieldName, expressions) {:#divide_cf36e43} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides a field's value by an expression. + Signature: ```typescript -export declare function descending(fieldName: string): Ordering; +export declare function divide(fieldName: string, expressions: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to create a descending ordering for. A new Ordering for descending sorting. | +| fieldName | string | The field name to be divided. | +| expressions | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. | Returns: -[Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### divide(fieldName, expressions) {:#divide_cf36e43} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides a field's value by an expression. ```typescript // Divide the 'total' field by the 'count' field @@ -4758,10 +3803,17 @@ divide("total", field("count")); ``` +### divide(fieldName, value) {:#divide_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides a field's value by a constant value. + Signature: ```typescript -export declare function divide(fieldName: string, expressions: Expression): FunctionExpression; +export declare function divide(fieldName: string, value: unknown): FunctionExpression; ``` #### Parameters @@ -4769,18 +3821,16 @@ export declare function divide(fieldName: string, expressions: Expression): Func | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to be divided. | -| expressions | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. A new representing the division operation. | +| value | unknown | The constant value to divide by. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### divide(fieldName, value) {:#divide_65e2f32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides a field's value by a constant value. ```typescript // Divide the 'value' field by 10 @@ -4788,29 +3838,34 @@ divide("value", 10); ``` +### dotProduct(fieldName, vector) {:#dotproduct_463a23e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between a field's vector value and a double array. + Signature: ```typescript -export declare function divide(fieldName: string, value: unknown): FunctionExpression; +export declare function dotProduct(fieldName: string, vector: number[] | VectorValue): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to be divided. | -| value | unknown | The constant value to divide by. A new representing the division operation. | +| fieldName | string | The name of the field containing the first vector. | +| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(fieldName, vector) {:#dotproduct_463a23e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between a field's vector value and a double array. ```typescript // Calculate the dot product distance between a feature vector and a target vector @@ -4818,10 +3873,17 @@ dotProduct("features", [0.5, 0.8, 0.2]); ``` +### dotProduct(fieldName, vectorExpression) {:#dotproduct_ed766a1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between a field's vector value and a vector expression. + Signature: ```typescript -export declare function dotProduct(fieldName: string, vector: number[] | VectorValue): FunctionExpression; +export declare function dotProduct(fieldName: string, vectorExpression: Expression): FunctionExpression; ``` #### Parameters @@ -4829,18 +3891,16 @@ export declare function dotProduct(fieldName: string, vector: number[] | VectorV | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the first vector. | -| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. A new representing the dot product between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to calculate with. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(fieldName, vectorExpression) {:#dotproduct_ed766a1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between a field's vector value and a vector expression. ```typescript // Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2' @@ -4848,29 +3908,34 @@ dotProduct("docVector1", field("docVector2")); ``` +### endsWith(fieldName, suffix) {:#endswith_05ca3b0} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value ends with a given postfix. + Signature: ```typescript -export declare function dotProduct(fieldName: string, vectorExpression: Expression): FunctionExpression; +export declare function endsWith(fieldName: string, suffix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the first vector. | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to calculate with. A new representing the dot product between the two vectors. | +| fieldName | string | The field name to check. | +| suffix | string | The postfix to check for. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(fieldName, suffix) {:#endswith_05ca3b0} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value ends with a given postfix. ```typescript // Check if the 'filename' field ends with ".txt" @@ -4878,10 +3943,17 @@ endsWith("filename", ".txt"); ``` +### endsWith(fieldName, suffix) {:#endswith_8fc0ebc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value ends with a given postfix. + Signature: ```typescript -export declare function endsWith(fieldName: string, suffix: string): BooleanExpression; +export declare function endsWith(fieldName: string, suffix: Expression): BooleanExpression; ``` #### Parameters @@ -4889,18 +3961,16 @@ export declare function endsWith(fieldName: string, suffix: string): BooleanExpr | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| suffix | string | The postfix to check for. A new representing the 'ends with' comparison. | +| suffix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the postfix. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(fieldName, suffix) {:#endswith_8fc0ebc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value ends with a given postfix. ```typescript // Check if the 'url' field ends with the value of the 'extension' field @@ -4908,29 +3978,34 @@ endsWith("url", field("extension")); ``` +### equal(fieldName, expression) {:#equal_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to an expression. + Signature: ```typescript -export declare function endsWith(fieldName: string, suffix: Expression): BooleanExpression; +export declare function equal(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to check. | -| suffix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the postfix. A new representing the 'ends with' comparison. | +| fieldName | string | The field name to compare. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### equal(fieldName, expression) {:#equal_1e91657} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to an expression. ```typescript // Check if the 'age' field is equal to the 'limit' field @@ -4938,10 +4013,17 @@ equal("age", field("limit")); ``` +### equal(fieldName, value) {:#equal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to a constant value. + Signature: ```typescript -export declare function equal(fieldName: string, expression: Expression): BooleanExpression; +export declare function equal(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -4949,18 +4031,16 @@ export declare function equal(fieldName: string, expression: Expression): Boolea | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the equality comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### equal(fieldName, value) {:#equal_65e2f32} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to a constant value. ```typescript // Check if the 'city' field is equal to string constant "London" @@ -4968,29 +4048,34 @@ equal("city", "London"); ``` +### equalAny(fieldName, values) {:#equalany_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to any of the provided values or expressions. + Signature: ```typescript -export declare function equal(fieldName: string, value: unknown): BooleanExpression; +export declare function equalAny(fieldName: string, values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the equality comparison. | +| fieldName | string | The field to compare. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The values to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(fieldName, values) {:#equalany_8060b23} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -4998,10 +4083,17 @@ equalAny("category", [constant("Electronics"), field("primaryType")]); ``` +### equalAny(fieldName, arrayExpression) {:#equalany_48da8d9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to any of the provided values or expressions. + Signature: ```typescript -export declare function equalAny(fieldName: string, values: Array): BooleanExpression; +export declare function equalAny(fieldName: string, arrayExpression: Expression): BooleanExpression; ``` #### Parameters @@ -5009,18 +4101,16 @@ export declare function equalAny(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(fieldName, arrayExpression) {:#equalany_48da8d9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -5028,29 +4118,34 @@ equalAny("category", ["Electronics", field("primaryType")]); ``` +### euclideanDistance(fieldName, vector) {:#euclideandistance_463a23e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between a field's vector value and a double array. + Signature: ```typescript -export declare function equalAny(fieldName: string, arrayExpression: Expression): BooleanExpression; +export declare function euclideanDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to compare. | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for equality to the input field. A new representing the 'IN' comparison. | +| fieldName | string | The name of the field containing the first vector. | +| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(fieldName, vector) {:#euclideandistance_463a23e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between a field's vector value and a double array. ```typescript // Calculate the Euclidean distance between the 'location' field and a target location @@ -5058,10 +4153,17 @@ euclideanDistance("location", [37.7749, -122.4194]); ``` +### euclideanDistance(fieldName, vectorExpression) {:#euclideandistance_ed766a1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between a field's vector value and a vector expression. + Signature: ```typescript -export declare function euclideanDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; +export declare function euclideanDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; ``` #### Parameters @@ -5069,18 +4171,16 @@ export declare function euclideanDistance(fieldName: string, vector: number[] | | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the first vector. | -| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. A new representing the Euclidean distance between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(fieldName, vectorExpression) {:#euclideandistance_ed766a1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between a field's vector value and a vector expression. ```typescript // Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' @@ -5088,29 +4188,33 @@ euclideanDistance("pointA", field("pointB")); ``` +### exists(fieldName) {:#exists_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field exists. + Signature: ```typescript -export declare function euclideanDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; +export declare function exists(fieldName: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the first vector. | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the Euclidean distance between the two vectors. | +| fieldName | string | The field name to check. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### exists(fieldName) {:#exists_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'exists' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field exists. ```typescript // Check if the document has a field named "phoneNumber" @@ -5118,81 +4222,93 @@ exists("phoneNumber"); ``` +### exp(fieldName) {:#exp_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes e to the power of the expression's result. + Signature: ```typescript -export declare function exists(fieldName: string): BooleanExpression; +export declare function exp(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to check. A new representing the 'exists' check. | +| fieldName | string | | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### exp(fieldName) {:#exp_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the exp of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes e to the power of the expression's result. ```typescript // Compute e to the power of the 'value' field. exp('value'); -``` - A new representing the exp of the numeric value. +``` + +### floor(fieldName) {:#floor_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the floor of a numeric value. Signature: ```typescript -export declare function exp(fieldName: string): FunctionExpression; +export declare function floor(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | | +| fieldName | string | The name of the field to compute the floor of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### floor(fieldName) {:#floor_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the floor of the numeric value. + +### greaterThan(fieldName, expression) {:#greaterthan_1e91657} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an expression that computes the floor of a numeric value. +Creates an expression that checks if a field's value is greater than an expression. Signature: ```typescript -export declare function floor(fieldName: string): FunctionExpression; +export declare function greaterThan(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the floor of. A new representing the floor of the numeric value. | +| fieldName | string | The field name to compare. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThan(fieldName, expression) {:#greaterthan_1e91657} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than an expression. ```typescript // Check if the value of field 'age' is greater than the value of field 'limit' @@ -5200,10 +4316,17 @@ greaterThan("age", field("limit")); ``` +### greaterThan(fieldName, value) {:#greaterthan_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is greater than a constant value. + Signature: ```typescript -export declare function greaterThan(fieldName: string, expression: Expression): BooleanExpression; +export declare function greaterThan(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5211,18 +4334,16 @@ export declare function greaterThan(fieldName: string, expression: Expression): | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the greater than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThan(fieldName, value) {:#greaterthan_65e2f32} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than a constant value. ```typescript // Check if the 'price' field is greater than 100 @@ -5230,10 +4351,17 @@ greaterThan("price", 100); ``` +### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_2e16acb} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is greater than or equal to an expression. + Signature: ```typescript -export declare function greaterThan(fieldName: string, value: unknown): BooleanExpression; +export declare function greaterThanOrEqual(fieldName: string, value: Expression): BooleanExpression; ``` #### Parameters @@ -5241,18 +4369,16 @@ export declare function greaterThan(fieldName: string, value: unknown): BooleanE | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than comparison. | +| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_2e16acb} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than or equal to an expression. ```typescript // Check if the value of field 'age' is greater than or equal to the value of field 'limit' @@ -5260,10 +4386,17 @@ greaterThanOrEqual("age", field("limit")); ``` +### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is greater than or equal to a constant value. + Signature: ```typescript -export declare function greaterThanOrEqual(fieldName: string, value: Expression): BooleanExpression; +export declare function greaterThanOrEqual(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5271,18 +4404,16 @@ export declare function greaterThanOrEqual(fieldName: string, value: Expression) | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the greater than or equal to comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_65e2f32} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than or equal to a constant value. ```typescript // Check if the 'score' field is greater than or equal to 80 @@ -5290,29 +4421,33 @@ greaterThanOrEqual("score", 80); ``` +### length\_2(fieldName) {:#length_2_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string, array, map, vector, or bytes. + Signature: ```typescript -export declare function greaterThanOrEqual(fieldName: string, value: unknown): BooleanExpression; +declare function length_2(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than or equal to comparison. | +| fieldName | string | The name of the field to calculate the length of. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### length\_2(fieldName) {:#length_2_e5b0480} +A new `Expression` representing the length of the string, array, map, vector, or bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string, array, map, vector, or bytes. ```typescript // Get the length of the 'name' field. @@ -5323,28 +4458,34 @@ length("cart"); ``` +### lessThan(fieldName, expression) {:#lessthan_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than an expression. + Signature: ```typescript -declare function length_2(fieldName: string): FunctionExpression; +export declare function lessThan(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to calculate the length of. A new Expr representing the length of the string, array, map, vector, or bytes. | +| fieldName | string | The field name to compare. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThan(fieldName, expression) {:#lessthan_1e91657} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than an expression. ```typescript // Check if the 'age' field is less than the 'limit' field @@ -5352,10 +4493,17 @@ lessThan("age", field("limit")); ``` +### lessThan(fieldName, value) {:#lessthan_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than a constant value. + Signature: ```typescript -export declare function lessThan(fieldName: string, expression: Expression): BooleanExpression; +export declare function lessThan(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5363,18 +4511,16 @@ export declare function lessThan(fieldName: string, expression: Expression): Boo | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the less than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThan(fieldName, value) {:#lessthan_65e2f32} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than a constant value. ```typescript // Check if the 'price' field is less than 50 @@ -5382,10 +4528,17 @@ lessThan("price", 50); ``` +### lessThanOrEqual(fieldName, expression) {:#lessthanorequal_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than or equal to an expression. + Signature: ```typescript -export declare function lessThan(fieldName: string, value: unknown): BooleanExpression; +export declare function lessThanOrEqual(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters @@ -5393,18 +4546,16 @@ export declare function lessThan(fieldName: string, value: unknown): BooleanExpr | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than comparison. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(fieldName, expression) {:#lessthanorequal_1e91657} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than or equal to an expression. ```typescript // Check if the 'quantity' field is less than or equal to the 'limit' field @@ -5412,10 +4563,17 @@ lessThan("quantity", field("limit")); ``` +### lessThanOrEqual(fieldName, value) {:#lessthanorequal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than or equal to a constant value. + Signature: ```typescript -export declare function lessThanOrEqual(fieldName: string, expression: Expression): BooleanExpression; +export declare function lessThanOrEqual(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5423,18 +4581,16 @@ export declare function lessThanOrEqual(fieldName: string, expression: Expressio | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the less than or equal to comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(fieldName, value) {:#lessthanorequal_65e2f32} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than or equal to a constant value. ```typescript // Check if the 'score' field is less than or equal to 70 @@ -5442,29 +4598,34 @@ lessThan("score", 70); ``` +### like(fieldName, pattern) {:#like_67f7432} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison against a field. + Signature: ```typescript -export declare function lessThanOrEqual(fieldName: string, value: unknown): BooleanExpression; +export declare function like(fieldName: string, pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than or equal to comparison. | +| fieldName | string | The name of the field containing the string. | +| pattern | string | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### like(fieldName, pattern) {:#like_67f7432} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison against a field. ```typescript // Check if the 'title' field contains the string "guide" @@ -5472,10 +4633,17 @@ like("title", "%guide%"); ``` +### like(fieldName, pattern) {:#like_cb1318d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison against a field. + Signature: ```typescript -export declare function like(fieldName: string, pattern: string): BooleanExpression; +export declare function like(fieldName: string, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -5483,18 +4651,16 @@ export declare function like(fieldName: string, pattern: string): BooleanExpress | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | string | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### like(fieldName, pattern) {:#like_cb1318d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison against a field. ```typescript // Check if the 'title' field contains the string "guide" @@ -5502,29 +4668,33 @@ like("title", field("pattern")); ``` +### ln(fieldName) {:#ln_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the natural logarithm of a numeric value. + Signature: ```typescript -export declare function like(fieldName: string, pattern: Expression): BooleanExpression; +export declare function ln(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| fieldName | string | The name of the field to compute the natural logarithm of. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### ln(fieldName) {:#ln_e5b0480} +A new `Expression` representing the natural logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the natural logarithm of a numeric value. ```typescript // Compute the natural logarithm of the 'value' field. @@ -5532,28 +4702,34 @@ ln("value"); ``` +### log(fieldName, base) {:#log_a89e21b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of a field to a given base. + Signature: ```typescript -export declare function ln(fieldName: string): FunctionExpression; +export declare function log(fieldName: string, base: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the natural logarithm of. A new Expr representing the natural logarithm of the numeric value. | +| fieldName | string | The name of the field to compute the logarithm of. | +| base | number | The base of the logarithm. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### log(fieldName, base) {:#log_a89e21b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of a field to a given base. ```typescript // Compute the logarithm of the 'value' field with base 10. @@ -5561,10 +4737,17 @@ log("value", 10); ``` +### log(fieldName, base) {:#log_805b11f} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of a field to a given base. + Signature: ```typescript -export declare function log(fieldName: string, base: number): FunctionExpression; +export declare function log(fieldName: string, base: Expression): FunctionExpression; ``` #### Parameters @@ -5572,18 +4755,16 @@ export declare function log(fieldName: string, base: number): FunctionExpression | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field to compute the logarithm of. | -| base | number | The base of the logarithm. A new representing the logarithm of the numeric value. | +| base | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The base of the logarithm. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### log(fieldName, base) {:#log_805b11f} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of a field to a given base. ```typescript // Compute the logarithm of the 'value' field with the base in the 'base' field. @@ -5591,29 +4772,33 @@ log("value", field("base")); ``` +### log10(fieldName) {:#log10_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the base-10 logarithm of a numeric value. + Signature: ```typescript -export declare function log(fieldName: string, base: Expression): FunctionExpression; +export declare function log10(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the logarithm of. | -| base | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The base of the logarithm. A new representing the logarithm of the numeric value. | +| fieldName | string | The name of the field to compute the base-10 logarithm of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### log10(fieldName) {:#log10_e5b0480} +A new `Expression` representing the base-10 logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the base-10 logarithm of a numeric value. ```typescript // Compute the base-10 logarithm of the 'value' field. @@ -5621,40 +4806,54 @@ log10("value"); ``` +### logicalMaximum(fieldName, second, others) {:#logicalmaximum_828272e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. + Signature: ```typescript -export declare function log10(fieldName: string): FunctionExpression; +export declare function logicalMaximum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the base-10 logarithm of. A new Expr representing the base-10 logarithm of the numeric value. | +| fieldName | string | The first operand field name. | +| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | +| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### logicalMaximum(fieldName, second, others) {:#logicalmaximum_828272e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical maximum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. ```typescript // Returns the largest value between the 'field1' field, the 'field2' field, // and 1000. logicalMaximum("field1", field("field2"), 1000); -``` +``` + +### logicalMinimum(fieldName, second, others) {:#logicalminimum_828272e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. Signature: ```typescript -export declare function logicalMaximum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; +export declare function logicalMinimum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; ``` #### Parameters @@ -5663,18 +4862,16 @@ export declare function logicalMaximum(fieldName: string, second: Expression | u | --- | --- | --- | | fieldName | string | The first operand field name. | | second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical maximum operation. | +| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### logicalMinimum(fieldName, second, others) {:#logicalminimum_828272e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical minimum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. ```typescript // Returns the smallest value between the 'field1' field, the 'field2' field, @@ -5683,30 +4880,34 @@ logicalMinimum("field1", field("field2"), 1000); ``` +### mapGet(fieldName, subField) {:#mapget_06663cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Accesses a value from a map (object) field using the provided key. + Signature: ```typescript -export declare function logicalMinimum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; +export declare function mapGet(fieldName: string, subField: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The first operand field name. | -| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical minimum operation. | +| fieldName | string | The field name of the map field. | +| subField | string | The key to access in the map. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### mapGet(fieldName, subField) {:#mapget_06663cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the value associated with the given key in the map. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Accesses a value from a map (object) field using the provided key. ```typescript // Get the 'city' value from the 'address' map field @@ -5714,29 +4915,33 @@ mapGet("address", "city"); ``` +### maximum(fieldName) {:#maximum_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the maximum value of a field across multiple stage inputs. + Signature: ```typescript -export declare function mapGet(fieldName: string, subField: string): FunctionExpression; +export declare function maximum(fieldName: string): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name of the map field. | -| subField | string | The key to access in the map. A new representing the value associated with the given key in the map. | +| fieldName | string | The name of the field to find the maximum value of. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### maximum(fieldName) {:#maximum_e5b0480} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'maximum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the maximum value of a field across multiple stage inputs. ```typescript // Find the highest score in a leaderboard @@ -5744,28 +4949,33 @@ maximum("score").as("highestScore"); ``` +### minimum(fieldName) {:#minimum_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the minimum value of a field across multiple stage inputs. + Signature: ```typescript -export declare function maximum(fieldName: string): AggregateFunction; +export declare function minimum(fieldName: string): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to find the maximum value of. A new representing the 'maximum' aggregation. | +| fieldName | string | The name of the field to find the minimum value of. | Returns: [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### minimum(fieldName) {:#minimum_e5b0480} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'minimum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the minimum value of a field across multiple stage inputs. ```typescript // Find the lowest price of all products @@ -5773,28 +4983,34 @@ minimum("price").as("lowestPrice"); ``` +### mod(fieldName, expression) {:#mod_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. + Signature: ```typescript -export declare function minimum(fieldName: string): AggregateFunction; +export declare function mod(fieldName: string, expression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to find the minimum value of. A new representing the 'minimum' aggregation. | +| fieldName | string | The dividend field name. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The divisor expression. | Returns: -[AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### mod(fieldName, expression) {:#mod_1e91657} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. ```typescript // Calculate the remainder of dividing 'field1' by 'field2'. @@ -5802,10 +5018,17 @@ mod("field1", field("field2")); ``` +### mod(fieldName, value) {:#mod_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. + Signature: ```typescript -export declare function mod(fieldName: string, expression: Expression): FunctionExpression; +export declare function mod(fieldName: string, value: unknown): FunctionExpression; ``` #### Parameters @@ -5813,18 +5036,16 @@ export declare function mod(fieldName: string, expression: Expression): Function | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The dividend field name. | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The divisor expression. A new representing the modulo operation. | +| value | unknown | The divisor constant. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### mod(fieldName, value) {:#mod_65e2f32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. ```typescript // Calculate the remainder of dividing 'field1' by 5. @@ -5832,29 +5053,34 @@ mod("field1", 5); ``` +### multiply(fieldName, second) {:#multiply_b75bb8b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that multiplies a field's value by an expression. + Signature: ```typescript -export declare function mod(fieldName: string, value: unknown): FunctionExpression; +export declare function multiply(fieldName: string, second: Expression | unknown): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The dividend field name. | -| value | unknown | The divisor constant. A new representing the modulo operation. | +| fieldName | string | The name of the field containing the value to add. | +| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal to add. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### multiply(fieldName, second) {:#multiply_b75bb8b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the multiplication operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that multiplies a field's value by an expression. ```typescript // Multiply the 'quantity' field by the 'price' field @@ -5862,29 +5088,34 @@ multiply("quantity", field("price")); ``` +### notEqual(fieldName, expression) {:#notequal_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to an expression. + Signature: ```typescript -export declare function multiply(fieldName: string, second: Expression | unknown): FunctionExpression; +export declare function notEqual(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the value to add. | -| second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal to add. | +| fieldName | string | The field name to compare. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### notEqual(fieldName, expression) {:#notequal_1e91657} +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to an expression. ```typescript // Check if the 'status' field is not equal to the value of 'expectedStatus' @@ -5892,10 +5123,17 @@ notEqual("status", field("expectedStatus")); ``` +### notEqual(fieldName, value) {:#notequal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to a constant value. + Signature: ```typescript -export declare function notEqual(fieldName: string, expression: Expression): BooleanExpression; +export declare function notEqual(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5903,18 +5141,16 @@ export declare function notEqual(fieldName: string, expression: Expression): Boo | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the inequality comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### notEqual(fieldName, value) {:#notequal_65e2f32} +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to a constant value. ```typescript // Check if the 'country' field is not equal to "USA" @@ -5922,10 +5158,17 @@ notEqual("country", "USA"); ``` +### notEqualAny(fieldName, values) {:#notequalany_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. + Signature: ```typescript -export declare function notEqual(fieldName: string, value: unknown): BooleanExpression; +export declare function notEqualAny(fieldName: string, values: Array): BooleanExpression; ``` #### Parameters @@ -5933,18 +5176,16 @@ export declare function notEqual(fieldName: string, value: unknown): BooleanExpr | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the inequality comparison. | +| values | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | The values to check against. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### notEqualAny(fieldName, values) {:#notequalany_8060b23} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. ```typescript // Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' @@ -5952,10 +5193,17 @@ notEqualAny("status", [constant("pending"), field("rejectedStatus")]); ``` +### notEqualAny(fieldName, arrayExpression) {:#notequalany_48da8d9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. + Signature: ```typescript -export declare function notEqualAny(fieldName: string, values: Array): BooleanExpression; +export declare function notEqualAny(fieldName: string, arrayExpression: Expression): BooleanExpression; ``` #### Parameters @@ -5963,18 +5211,16 @@ export declare function notEqualAny(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### notEqualAny(fieldName, arrayExpression) {:#notequalany_48da8d9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. ```typescript // Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' @@ -5982,29 +5228,34 @@ notEqualAny("status", field("rejectedStatuses")); ``` +### regexContains(fieldName, pattern) {:#regexcontains_67f7432} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a specified regular expression as a substring. + Signature: ```typescript -export declare function notEqualAny(fieldName: string, arrayExpression: Expression): BooleanExpression; +export declare function regexContains(fieldName: string, pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to compare. | -| arrayExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The values to check against. A new representing the 'NOT IN' comparison. | +| fieldName | string | The name of the field containing the string. | +| pattern | string | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(fieldName, pattern) {:#regexcontains_67f7432} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) @@ -6012,10 +5263,17 @@ regexContains("description", "(?i)example"); ``` +### regexContains(fieldName, pattern) {:#regexcontains_cb1318d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a specified regular expression as a substring. + Signature: ```typescript -export declare function regexContains(fieldName: string, pattern: string): BooleanExpression; +export declare function regexContains(fieldName: string, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -6023,18 +5281,16 @@ export declare function regexContains(fieldName: string, pattern: string): Boole | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | string | The regular expression to use for the search. A new representing the 'contains' comparison. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(fieldName, pattern) {:#regexcontains_cb1318d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) @@ -6042,10 +5298,17 @@ regexContains("description", field("pattern")); ``` +### regexMatch(fieldName, pattern) {:#regexmatch_67f7432} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field matches a specified regular expression. + Signature: ```typescript -export declare function regexContains(fieldName: string, pattern: Expression): BooleanExpression; +export declare function regexMatch(fieldName: string, pattern: string): BooleanExpression; ``` #### Parameters @@ -6053,18 +5316,16 @@ export declare function regexContains(fieldName: string, pattern: Expression): B | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the search. A new representing the 'contains' comparison. | +| pattern | string | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(fieldName, pattern) {:#regexmatch_67f7432} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -6072,10 +5333,17 @@ regexMatch("email", "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); ``` +### regexMatch(fieldName, pattern) {:#regexmatch_cb1318d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field matches a specified regular expression. + Signature: ```typescript -export declare function regexMatch(fieldName: string, pattern: string): BooleanExpression; +export declare function regexMatch(fieldName: string, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -6083,18 +5351,16 @@ export declare function regexMatch(fieldName: string, pattern: string): BooleanE | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | string | The regular expression to use for the match. A new representing the regular expression match. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(fieldName, pattern) {:#regexmatch_cb1318d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -6102,23 +5368,6 @@ regexMatch("email", field("pattern")); ``` -Signature: - -```typescript -export declare function regexMatch(fieldName: string, pattern: Expression): BooleanExpression; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| fieldName | string | The name of the field containing the string. | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the match. A new representing the regular expression match. | - -Returns: - -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) - ### round(fieldName) {:#round_e5b0480} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -6126,12 +5375,6 @@ export declare function regexMatch(fieldName: string, pattern: Expression): Bool Creates an expression that rounds a numeric value to the nearest whole number. -```typescript -// Round the value of the 'price' field. -round("price"); - -``` - Signature: ```typescript @@ -6140,13 +5383,24 @@ export declare function round(fieldName: string): FunctionExpression; #### Parameters -| Parameter | Type | Description | -| --- | --- | --- | -| fieldName | string | The name of the field to round. A new Expr representing the rounded value. | +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | The name of the field to round. | + +Returns: + +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new `Expression` representing the rounded value. + +### Example + -Returns: +```typescript +// Round the value of the 'price' field. +round("price"); -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +``` ### round(fieldName, decimalPlaces) {:#round_07d0cf0} @@ -6155,12 +5409,6 @@ export declare function round(fieldName: string): FunctionExpression; Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -round("price", 2); - -``` - Signature: ```typescript @@ -6172,12 +5420,23 @@ export declare function round(fieldName: string, decimalPlaces: number | Express | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field to round. | -| decimalPlaces | number \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | number \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the rounded value. + +### Example + + +```typescript +// Round the value of the 'price' field to two decimal places. +round("price", 2); + +``` + ### split(fieldName, delimiter) {:#split_2cfdd37} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -6196,12 +5455,14 @@ export declare function split(fieldName: string, delimiter: string): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | Split the value in this field. | -| delimiter | string | Split on this delimiter. A new representing the split function. | +| delimiter | string | Split on this delimiter. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -6229,12 +5490,14 @@ export declare function split(fieldName: string, delimiter: Expression): Functio | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | Split the value in this field. | -| delimiter | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. A new representing the split function. | +| delimiter | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -6251,12 +5514,6 @@ split('scores', conditional(field('format').equal('csv'), constant(','), constan Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt("value"); - -``` - Signature: ```typescript @@ -6267,25 +5524,30 @@ export declare function sqrt(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the square root of. A new representing the square root of the numeric value. | +| fieldName | string | The name of the field to compute the square root of. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### startsWith(fieldName, prefix) {:#startswith_89325cc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the square root of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value starts with a given prefix. ```typescript -// Check if the 'name' field starts with "Mr." -startsWith("name", "Mr."); +// Compute the square root of the 'value' field. +sqrt("value"); ``` +### startsWith(fieldName, prefix) {:#startswith_89325cc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value starts with a given prefix. + Signature: ```typescript @@ -6297,25 +5559,30 @@ export declare function startsWith(fieldName: string, prefix: string): BooleanEx | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| prefix | string | The prefix to check for. A new representing the 'starts with' comparison. | +| prefix | string | The prefix to check for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### startsWith(fieldName, prefix) {:#startswith_266c338} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value starts with a given prefix. ```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -startsWith("fullName", field("firstName")); +// Check if the 'name' field starts with "Mr." +startsWith("name", "Mr."); ``` +### startsWith(fieldName, prefix) {:#startswith_266c338} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value starts with a given prefix. + Signature: ```typescript @@ -6327,25 +5594,30 @@ export declare function startsWith(fieldName: string, prefix: Expression): Boole | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| prefix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the prefix. A new representing the 'starts with' comparison. | +| prefix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the prefix. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### stringConcat(fieldName, secondString, otherStrings) {:#stringconcat_d80077e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates string functions, fields or constants together. ```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat("firstName", " ", field("lastName")); +// Check if the 'fullName' field starts with the value of the 'firstName' field +startsWith("fullName", field("firstName")); ``` +### stringConcat(fieldName, secondString, otherStrings) {:#stringconcat_d80077e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates string functions, fields or constants together. + Signature: ```typescript @@ -6358,25 +5630,30 @@ export declare function stringConcat(fieldName: string, secondString: Expression | --- | --- | --- | | fieldName | string | The field name containing the initial string value. | | secondString | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string | An expression or string literal to concatenate. | -| otherStrings | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. A new representing the concatenated string. | +| otherStrings | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### stringContains(fieldName, substring) {:#stringcontains_5b94cfe} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a specified substring. ```typescript -// Check if the 'description' field contains "example". -stringContains("description", "example"); +// Combine the 'firstName', " ", and 'lastName' fields into a single string +stringConcat("firstName", " ", field("lastName")); ``` +### stringContains(fieldName, substring) {:#stringcontains_5b94cfe} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a specified substring. + Signature: ```typescript @@ -6388,25 +5665,30 @@ export declare function stringContains(fieldName: string, substring: string): Bo | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| substring | string | The substring to search for. A new representing the 'contains' comparison. | +| substring | string | The substring to search for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### stringContains(fieldName, substring) {:#stringcontains_ac3ba47} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a substring specified by an expression. ```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -stringContains("description", field("keyword")); +// Check if the 'description' field contains "example". +stringContains("description", "example"); ``` +### stringContains(fieldName, substring) {:#stringcontains_ac3ba47} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a substring specified by an expression. + Signature: ```typescript @@ -6418,25 +5700,30 @@ export declare function stringContains(fieldName: string, substring: Expression) | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| substring | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the substring to search for. A new representing the 'contains' comparison. | +| substring | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the substring to search for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### subtract(fieldName, expression) {:#subtract_1e91657} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts an expression from a field's value. ```typescript -// Subtract the 'discount' field from the 'price' field -subtract("price", field("discount")); +// Check if the 'description' field contains the value of the 'keyword' field. +stringContains("description", field("keyword")); ``` +### subtract(fieldName, expression) {:#subtract_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts an expression from a field's value. + Signature: ```typescript @@ -6448,25 +5735,30 @@ export declare function subtract(fieldName: string, expression: Expression): Fun | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to subtract from. | -| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract. A new representing the subtraction operation. | +| expression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### subtract(fieldName, value) {:#subtract_65e2f32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a constant value from a field's value. ```typescript -// Subtract 20 from the value of the 'total' field -subtract("total", 20); +// Subtract the 'discount' field from the 'price' field +subtract("price", field("discount")); ``` +### subtract(fieldName, value) {:#subtract_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a constant value from a field's value. + Signature: ```typescript @@ -6478,25 +5770,30 @@ export declare function subtract(fieldName: string, value: unknown): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to subtract from. | -| value | unknown | The constant value to subtract. A new representing the subtraction operation. | +| value | unknown | The constant value to subtract. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### sum(fieldName) {:#sum_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. ```typescript -// Calculate the total revenue from a set of orders -sum("orderAmount").as("totalRevenue"); +// Subtract 20 from the value of the 'total' field +subtract("total", 20); ``` +### sum(fieldName) {:#sum_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. + Signature: ```typescript @@ -6507,25 +5804,30 @@ export declare function sum(fieldName: string): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing numeric values to sum up. A new representing the 'sum' aggregation. | +| fieldName | string | The name of the field containing numeric values to sum up. | Returns: [AggregateFunction](./firestore_lite_pipelines.aggregatefunction.md#aggregatefunction_class) -### timestampAdd(fieldName, unit, amount) {:#timestampadd_341fe7d} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'sum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to a timestamp represented by a field. ```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd("timestamp", "day", 1); +// Calculate the total revenue from a set of orders +sum("orderAmount").as("totalRevenue"); ``` +### timestampAdd(fieldName, unit, amount) {:#timestampadd_341fe7d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to a timestamp represented by a field. + Signature: ```typescript @@ -6538,25 +5840,30 @@ export declare function timestampAdd(fieldName: string, unit: 'microsecond' | 'm | --- | --- | --- | | fieldName | string | The name of the field representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to add (e.g., "day", "hour"). | -| amount | number | The amount of time to add. A new representing the resulting timestamp. | +| amount | number | The amount of time to add. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampSubtract(fieldName, unit, amount) {:#timestampsubtract_341fe7d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. ```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract("timestamp", "day", 1); +// Add 1 day to the 'timestamp' field. +timestampAdd("timestamp", "day", 1); ``` +### timestampSubtract(fieldName, unit, amount) {:#timestampsubtract_341fe7d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. + Signature: ```typescript @@ -6569,25 +5876,30 @@ export declare function timestampSubtract(fieldName: string, unit: 'microsecond' | --- | --- | --- | | fieldName | string | The name of the field representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to subtract (e.g., "day", "hour"). | -| amount | number | The amount of time to subtract. A new representing the resulting timestamp. | +| amount | number | The amount of time to subtract. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixMicros(fieldName) {:#timestamptounixmicros_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to microseconds since epoch. -timestampToUnixMicros("timestamp"); +// Subtract 1 day from the 'timestamp' field. +timestampSubtract("timestamp", "day", 1); ``` +### timestampToUnixMicros(fieldName) {:#timestamptounixmicros_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -6598,25 +5910,30 @@ export declare function timestampToUnixMicros(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the timestamp. A new representing the number of microseconds since epoch. | +| fieldName | string | The name of the field representing the timestamp. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixMillis(fieldName) {:#timestamptounixmillis_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of microseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -timestampToUnixMillis("timestamp"); +// Convert the 'timestamp' field to microseconds since epoch. +timestampToUnixMicros("timestamp"); ``` +### timestampToUnixMillis(fieldName) {:#timestamptounixmillis_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -6627,25 +5944,30 @@ export declare function timestampToUnixMillis(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the timestamp. A new representing the number of milliseconds since epoch. | +| fieldName | string | The name of the field representing the timestamp. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixSeconds(fieldName) {:#timestamptounixseconds_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of milliseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to seconds since epoch. -timestampToUnixSeconds("timestamp"); +// Convert the 'timestamp' field to milliseconds since epoch. +timestampToUnixMillis("timestamp"); ``` +### timestampToUnixSeconds(fieldName) {:#timestamptounixseconds_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -6656,12 +5978,23 @@ export declare function timestampToUnixSeconds(fieldName: string): FunctionExpre | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the timestamp. A new representing the number of seconds since epoch. | +| fieldName | string | The name of the field representing the timestamp. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of seconds since epoch. + +### Example + + +```typescript +// Convert the 'timestamp' field to seconds since epoch. +timestampToUnixSeconds("timestamp"); + +``` + ### timestampTruncate(fieldName, granularity, timezone) {:#timestamptruncate_b6c7512} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -6681,12 +6014,14 @@ export declare function timestampTruncate(fieldName: string, granularity: TimeGr | --- | --- | --- | | fieldName | string | Truncate the timestamp value contained in this field. | | granularity | [TimeGranularity](./firestore_lite_pipelines.md#timegranularity) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -6715,12 +6050,14 @@ export declare function timestampTruncate(fieldName: string, granularity: Expres | --- | --- | --- | | fieldName | string | Truncate the timestamp value contained in this field. | | granularity | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -6737,12 +6074,6 @@ field('createdAt').timestampTruncate(field('granularity')) Creates an expression that converts a string field to lowercase. -```typescript -// Convert the 'name' field to lowercase -toLower("name"); - -``` - Signature: ```typescript @@ -6753,25 +6084,30 @@ export declare function toLower(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the lowercase string. | +| fieldName | string | The name of the field containing the string. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### toUpper(fieldName) {:#toupper_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the lowercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string field to uppercase. ```typescript -// Convert the 'title' field to uppercase -toUpper("title"); +// Convert the 'name' field to lowercase +toLower("name"); ``` +### toUpper(fieldName) {:#toupper_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string field to uppercase. + Signature: ```typescript @@ -6782,28 +6118,30 @@ export declare function toUpper(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the uppercase string. | +| fieldName | string | The name of the field containing the string. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### trim(fieldName, valueToTrim) {:#trim_c9f90ee} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the uppercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes leading and trailing whitespace from a string or byte array. ```typescript -// Trim whitespace from the 'userInput' field -trim("userInput"); - -// Trim quotes from the 'userInput' field -trim("userInput", '"'); +// Convert the 'title' field to uppercase +toUpper("title"); ``` +### trim(fieldName, valueToTrim) {:#trim_c9f90ee} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes leading and trailing whitespace from a string or byte array. + Signature: ```typescript @@ -6815,12 +6153,26 @@ export declare function trim(fieldName: string, valueToTrim?: string | Expressio | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string or byte array. | -| valueToTrim | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. A new representing the trimmed string. | +| valueToTrim | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the trimmed string. + +### Example + + +```typescript +// Trim whitespace from the 'userInput' field +trim("userInput"); + +// Trim quotes from the 'userInput' field +trim("userInput", '"'); + +``` + ### type(fieldName) {:#type_e5b0480} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -6844,6 +6196,8 @@ export declare function type(fieldName: string): FunctionExpression; [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the data type. + ### Example @@ -6852,7 +6206,6 @@ export declare function type(fieldName: string): FunctionExpression; type('title') ``` - A new {Expression} representing the data type. ### unixMicrosToTimestamp(fieldName) {:#unixmicrostotimestamp_e5b0480} @@ -6861,12 +6214,6 @@ type('title') Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -unixMicrosToTimestamp("microseconds"); - -``` - Signature: ```typescript @@ -6877,25 +6224,30 @@ export declare function unixMicrosToTimestamp(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the number of microseconds since epoch. A new representing the timestamp. | +| fieldName | string | The name of the field representing the number of microseconds since epoch. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### unixMillisToTimestamp(fieldName) {:#unixmillistotimestamp_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -unixMillisToTimestamp("milliseconds"); +// Interpret the 'microseconds' field as microseconds since epoch. +unixMicrosToTimestamp("microseconds"); ``` +### unixMillisToTimestamp(fieldName) {:#unixmillistotimestamp_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript @@ -6906,25 +6258,30 @@ export declare function unixMillisToTimestamp(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the number of milliseconds since epoch. A new representing the timestamp. | +| fieldName | string | The name of the field representing the number of milliseconds since epoch. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### unixSecondsToTimestamp(fieldName) {:#unixsecondstotimestamp_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'seconds' field as seconds since epoch. -unixSecondsToTimestamp("seconds"); +// Interpret the 'milliseconds' field as milliseconds since epoch. +unixMillisToTimestamp("milliseconds"); ``` +### unixSecondsToTimestamp(fieldName) {:#unixsecondstotimestamp_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript @@ -6935,25 +6292,30 @@ export declare function unixSecondsToTimestamp(fieldName: string): FunctionExpre | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the number of seconds since epoch. A new representing the timestamp. | +| fieldName | string | The name of the field representing the number of seconds since epoch. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### vectorLength(fieldName) {:#vectorlength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a Firestore Vector represented by a field. ```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength("embedding"); +// Interpret the 'seconds' field as seconds since epoch. +unixSecondsToTimestamp("seconds"); ``` +### vectorLength(fieldName) {:#vectorlength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a Firestore Vector represented by a field. + Signature: ```typescript @@ -6964,12 +6326,23 @@ export declare function vectorLength(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the Firestore Vector. A new representing the length of the array. | +| fieldName | string | The name of the field representing the Firestore Vector. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. + +### Example + + +```typescript +// Get the vector length (dimension) of the field 'embedding'. +vectorLength("embedding"); + +``` + ## function(first, ...) ### add(first, second) {:#add_846ca1b} @@ -6979,12 +6352,6 @@ export declare function vectorLength(fieldName: string): FunctionExpression; Creates an expression that adds two expressions together. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -add(field("quantity"), field("reserve")); - -``` - Signature: ```typescript @@ -7002,20 +6369,24 @@ export declare function add(first: Expression, second: Expression | unknown): Fu [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### and(first, second, more) {:#and_e0c48bd} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the addition operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a logical 'AND' operation on multiple filter conditions. ```typescript -// Check if the 'age' field is greater than 18 AND the 'city' field is "London" AND -// the 'status' field is "active" -const condition = and(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); +// Add the value of the 'quantity' field and the 'reserve' field. +add(field("quantity"), field("reserve")); ``` +### and(first, second, more) {:#and_e0c48bd} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a logical 'AND' operation on multiple filter conditions. + Signature: ```typescript @@ -7028,25 +6399,31 @@ export declare function and(first: BooleanExpression, second: BooleanExpression, | --- | --- | --- | | first | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The first filter condition. | | second | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The second filter condition. | -| more | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'AND' together. A new representing the logical 'AND' operation. | +| more | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'AND' together. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### concat(first, second, others) {:#concat_83be015} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical 'AND' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. ```typescript -// Concatenate the 'firstName' and 'lastName' fields with a space in between. -concat(field("firstName"), " ", field("lastName")) +// Check if the 'age' field is greater than 18 AND the 'city' field is "London" AND +// the 'status' field is "active" +const condition = and(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); ``` +### concat(first, second, others) {:#concat_83be015} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. + Signature: ```typescript @@ -7059,26 +6436,30 @@ export declare function concat(first: Expression, second: Expression | unknown, | --- | --- | --- | | first | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first expressions to concatenate. | | second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second literal or expression to concatenate. | -| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Additional literals or expressions to concatenate. A new Expression representing the concatenation. | +| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Additional literals or expressions to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### logicalMaximum(first, second, others) {:#logicalmaximum_83be015} +A new `Expression` representing the concatenation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. ```typescript -// Returns the largest value between the 'field1' field, the 'field2' field, -// and 1000 -logicalMaximum(field("field1"), field("field2"), 1000); +// Concatenate the 'firstName' and 'lastName' fields with a space in between. +concat(field("firstName"), " ", field("lastName")) ``` +### logicalMaximum(first, second, others) {:#logicalmaximum_83be015} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. + Signature: ```typescript @@ -7091,26 +6472,31 @@ export declare function logicalMaximum(first: Expression, second: Expression | u | --- | --- | --- | | first | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first operand expression. | | second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical maximum operation. | +| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### logicalMinimum(first, second, others) {:#logicalminimum_83be015} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical maximum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. ```typescript -// Returns the smallest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMinimum(field("field1"), field("field2"), 1000); +// Returns the largest value between the 'field1' field, the 'field2' field, +// and 1000 +logicalMaximum(field("field1"), field("field2"), 1000); ``` +### logicalMinimum(first, second, others) {:#logicalminimum_83be015} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. + Signature: ```typescript @@ -7123,25 +6509,31 @@ export declare function logicalMinimum(first: Expression, second: Expression | u | --- | --- | --- | | first | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first operand expression. | | second | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical minimum operation. | +| others | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### multiply(first, second) {:#multiply_846ca1b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical minimum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that multiplies two expressions together. ```typescript -// Multiply the 'quantity' field by the 'price' field -multiply(field("quantity"), field("price")); +// Returns the smallest value between the 'field1' field, the 'field2' field, +// and 1000. +logicalMinimum(field("field1"), field("field2"), 1000); ``` +### multiply(first, second) {:#multiply_846ca1b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that multiplies two expressions together. + Signature: ```typescript @@ -7159,20 +6551,24 @@ export declare function multiply(first: Expression, second: Expression | unknown [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### or(first, second, more) {:#or_e0c48bd} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the multiplication operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a logical 'OR' operation on multiple filter conditions. ```typescript -// Check if the 'age' field is greater than 18 OR the 'city' field is "London" OR -// the 'status' field is "active" -const condition = or(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); +// Multiply the 'quantity' field by the 'price' field +multiply(field("quantity"), field("price")); ``` +### or(first, second, more) {:#or_e0c48bd} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a logical 'OR' operation on multiple filter conditions. + Signature: ```typescript @@ -7185,29 +6581,31 @@ export declare function or(first: BooleanExpression, second: BooleanExpression, | --- | --- | --- | | first | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The first filter condition. | | second | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The second filter condition. | -| more | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'OR' together. A new representing the logical 'OR' operation. | +| more | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'OR' together. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### xor(first, second, additionalConditions) {:#xor_8197113} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical 'OR' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. ```typescript -// Check if only one of the conditions is true: 'age' greater than 18, 'city' is "London", -// or 'status' is "active". -const condition = xor( - greaterThan("age", 18), - equal("city", "London"), - equal("status", "active")); +// Check if the 'age' field is greater than 18 OR the 'city' field is "London" OR +// the 'status' field is "active" +const condition = or(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); ``` +### xor(first, second, additionalConditions) {:#xor_8197113} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. + Signature: ```typescript @@ -7220,11 +6618,26 @@ export declare function xor(first: BooleanExpression, second: BooleanExpression, | --- | --- | --- | | first | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The first condition. | | second | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The second condition. | -| additionalConditions | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional conditions to 'XOR' together. A new representing the logical 'XOR' operation. | +| additionalConditions | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional conditions to 'XOR' together. | + +Returns: + +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical 'XOR' operation. -Returns: +### Example -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) + +```typescript +// Check if only one of the conditions is true: 'age' greater than 18, 'city' is "London", +// or 'status' is "active". +const condition = xor( + greaterThan("age", 18), + equal("city", "London"), + equal("status", "active")); + +``` ## function(firstArray, ...) @@ -7235,12 +6648,6 @@ export declare function xor(first: BooleanExpression, second: BooleanExpression, Creates an expression that concatenates an array expression with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat(field("items"), [field("newItems"), field("otherItems")]); - -``` - Signature: ```typescript @@ -7253,12 +6660,23 @@ export declare function arrayConcat(firstArray: Expression, secondArray: Express | --- | --- | --- | | firstArray | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first array expression to concatenate to. | | secondArray | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\] | The second array expression or array literal to concatenate to. | -| otherArrays | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. A new representing the concatenated array. | +| otherArrays | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated array. + +### Example + + +```typescript +// Combine the 'items' array with two new item arrays +arrayConcat(field("items"), [field("newItems"), field("otherItems")]); + +``` + ## function(firstArrayField, ...) ### arrayConcat(firstArrayField, secondArray, otherArrays) {:#arrayconcat_f92063d} @@ -7268,12 +6686,6 @@ export declare function arrayConcat(firstArray: Expression, secondArray: Express Creates an expression that concatenates a field's array value with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat("items", [field("newItems"), field("otherItems")]); - -``` - Signature: ```typescript @@ -7286,12 +6698,23 @@ export declare function arrayConcat(firstArrayField: string, secondArray: Expres | --- | --- | --- | | firstArrayField | string | The first array to concatenate to. | | secondArray | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\] | The second array expression or array literal to concatenate to. | -| otherArrays | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. A new representing the concatenated array. | +| otherArrays | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated array. + +### Example + + +```typescript +// Combine the 'items' array with two new item arrays +arrayConcat("items", [field("newItems"), field("otherItems")]); + +``` + ## function(firstMap, ...) ### mapMerge(firstMap, secondMap, otherMaps) {:#mapmerge_cfe77ce} @@ -7301,13 +6724,6 @@ export declare function arrayConcat(firstArrayField: string, secondArray: Expres Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - Signature: ```typescript @@ -7326,6 +6742,16 @@ export declare function mapMerge(firstMap: Record | Expression, [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +### Example + + +``` +// Merges the map in the settings field with, a map literal, and a map in +// that is conditionally returned by another expression +mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) + +``` + ## function(firstString, ...) ### stringConcat(firstString, secondString, otherStrings) {:#stringconcat_8a8d1b6} @@ -7335,12 +6761,6 @@ export declare function mapMerge(firstMap: Record | Expression, Creates an expression that concatenates string expressions together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat(field("firstName"), " ", field("lastName")); - -``` - Signature: ```typescript @@ -7353,12 +6773,23 @@ export declare function stringConcat(firstString: Expression, secondString: Expr | --- | --- | --- | | firstString | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The initial string expression to concatenate to. | | secondString | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string | An expression or string literal to concatenate. | -| otherStrings | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. A new representing the concatenated string. | +| otherStrings | Array<[Expression](./firestore_lite_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated string. + +### Example + + +```typescript +// Combine the 'firstName', " ", and 'lastName' fields into a single string +stringConcat(field("firstName"), " ", field("lastName")); + +``` + ## function(ifExpr, ...) ### ifAbsent(ifExpr, elseExpr) {:#ifabsent_0e6d161} @@ -7368,13 +6799,6 @@ export declare function stringConcat(firstString: Expression, secondString: Expr Creates an expression that returns the `elseExpr` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent(field("optional_field"), constant("default_value")) - -``` - Signature: ```typescript @@ -7386,26 +6810,31 @@ export declare function ifAbsent(ifExpr: Expression, elseExpr: Expression): Expr | Parameter | Type | Description | | --- | --- | --- | | ifExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check for absence. | -| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if \[ifExpr\] is absent. A new Expression representing the ifAbsent operation. | +| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if \[ifExpr\] is absent. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) -### ifAbsent(ifExpr, elseValue) {:#ifabsent_c34e5ed} +A new Expression representing the ifAbsent operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. ```typescript // Returns the value of the optional field 'optional_field', or returns 'default_value' // if the field is absent. -ifAbsent(field("optional_field"), "default_value") +ifAbsent(field("optional_field"), constant("default_value")) ``` +### ifAbsent(ifExpr, elseValue) {:#ifabsent_c34e5ed} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. + Signature: ```typescript @@ -7417,12 +6846,24 @@ export declare function ifAbsent(ifExpr: Expression, elseValue: unknown): Expres | Parameter | Type | Description | | --- | --- | --- | | ifExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check for absence. | -| elseValue | unknown | The value that will be returned if ifExpr evaluates to an absent value. A new \[Expression\] representing the ifAbsent operation. | +| elseValue | unknown | The value that will be returned if ifExpr evaluates to an absent value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new \[Expression\] representing the ifAbsent operation. + +### Example + + +```typescript +// Returns the value of the optional field 'optional_field', or returns 'default_value' +// if the field is absent. +ifAbsent(field("optional_field"), "default_value") + +``` + ## function(ifFieldName, ...) ### ifAbsent(ifFieldName, elseExpr) {:#ifabsent_e6dabea} @@ -7432,13 +6873,6 @@ export declare function ifAbsent(ifExpr: Expression, elseValue: unknown): Expres Creates an expression that returns the `elseExpr` argument if `ifFieldName` is absent, else return the value of the field. -```typescript -// Returns the value of the optional field 'optional_field', or returns the value of -// 'default_field' if 'optional_field' is absent. -ifAbsent("optional_field", field("default_field")) - -``` - Signature: ```typescript @@ -7450,26 +6884,31 @@ export declare function ifAbsent(ifFieldName: string, elseExpr: Expression): Exp | Parameter | Type | Description | | --- | --- | --- | | ifFieldName | string | The field to check for absence. | -| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if ifFieldName is absent. A new Expression representing the ifAbsent operation. | +| elseExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if ifFieldName is absent. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) -### ifAbsent(ifFieldName, elseValue) {:#ifabsent_d8f2823} +A new Expression representing the ifAbsent operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else return the value of the field. ```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent("optional_field", "default_value") +// Returns the value of the optional field 'optional_field', or returns the value of +// 'default_field' if 'optional_field' is absent. +ifAbsent("optional_field", field("default_field")) ``` +### ifAbsent(ifFieldName, elseValue) {:#ifabsent_d8f2823} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else return the value of the field. + Signature: ```typescript @@ -7481,12 +6920,24 @@ export declare function ifAbsent(ifFieldName: string | Expression, elseValue: Ex | Parameter | Type | Description | | --- | --- | --- | | ifFieldName | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The field to check for absence. | -| elseValue | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The value that will be returned if \[ifFieldName\] is absent. A new Expression representing the ifAbsent operation. | +| elseValue | [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown | The value that will be returned if \[ifFieldName\] is absent. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new Expression representing the ifAbsent operation. + +### Example + + +```typescript +// Returns the value of the optional field 'optional_field', or returns 'default_value' +// if the field is absent. +ifAbsent("optional_field", "default_value") + +``` + ## function(input, ...) ### substring(input, position, length) {:#substring_e6e0aa3} @@ -7548,12 +6999,6 @@ export declare function substring(input: Expression, position: Expression, lengt Creates an expression that divides two expressions. -```typescript -// Divide the 'total' field by the 'count' field -divide(field("total"), field("count")); - -``` - Signature: ```typescript @@ -7565,25 +7010,30 @@ export declare function divide(left: Expression, right: Expression): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to be divided. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. A new representing the division operation. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to divide by. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### equal(left, right) {:#equal_b3c3382} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if two expressions are equal. ```typescript -// Check if the 'age' field is equal to an expression -equal(field("age"), field("minAge").add(10)); +// Divide the 'total' field by the 'count' field +divide(field("total"), field("count")); ``` +### equal(left, right) {:#equal_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if two expressions are equal. + Signature: ```typescript @@ -7595,25 +7045,30 @@ export declare function equal(left: Expression, right: Expression): BooleanExpre | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the equality comparison. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThan(left, right) {:#greaterthan_b3c3382} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is greater than the second expression. ```typescript -// Check if the 'age' field is greater than 18 -greaterThan(field("age"), Constant(9).add(9)); +// Check if the 'age' field is equal to an expression +equal(field("age"), field("minAge").add(10)); ``` +### greaterThan(left, right) {:#greaterthan_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is greater than the second expression. + Signature: ```typescript @@ -7625,25 +7080,30 @@ export declare function greaterThan(left: Expression, right: Expression): Boolea | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the greater than comparison. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(left, right) {:#greaterthanorequal_b3c3382} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is greater than or equal to the second expression. ```typescript -// Check if the 'quantity' field is greater than or equal to the field "threshold" -greaterThanOrEqual(field("quantity"), field("threshold")); +// Check if the 'age' field is greater than 18 +greaterThan(field("age"), Constant(9).add(9)); ``` +### greaterThanOrEqual(left, right) {:#greaterthanorequal_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is greater than or equal to the second expression. + Signature: ```typescript @@ -7655,25 +7115,30 @@ export declare function greaterThanOrEqual(left: Expression, right: Expression): | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the greater than or equal to comparison. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThan(left, right) {:#lessthan_b3c3382} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is less than the second expression. ```typescript -// Check if the 'age' field is less than 30 -lessThan(field("age"), field("limit")); +// Check if the 'quantity' field is greater than or equal to the field "threshold" +greaterThanOrEqual(field("quantity"), field("threshold")); ``` +### lessThan(left, right) {:#lessthan_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is less than the second expression. + Signature: ```typescript @@ -7685,25 +7150,30 @@ export declare function lessThan(left: Expression, right: Expression): BooleanEx | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the less than comparison. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(left, right) {:#lessthanorequal_b3c3382} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is less than or equal to the second expression. ```typescript -// Check if the 'quantity' field is less than or equal to 20 -lessThan(field("quantity"), field("limit")); +// Check if the 'age' field is less than 30 +lessThan(field("age"), field("limit")); ``` +### lessThanOrEqual(left, right) {:#lessthanorequal_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is less than or equal to the second expression. + Signature: ```typescript @@ -7715,25 +7185,30 @@ export declare function lessThanOrEqual(left: Expression, right: Expression): Bo | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the less than or equal to comparison. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### mod(left, right) {:#mod_b3c3382} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing two expressions. ```typescript -// Calculate the remainder of dividing 'field1' by 'field2'. -mod(field("field1"), field("field2")); +// Check if the 'quantity' field is less than or equal to 20 +lessThan(field("quantity"), field("limit")); ``` +### mod(left, right) {:#mod_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing two expressions. + Signature: ```typescript @@ -7745,11 +7220,22 @@ export declare function mod(left: Expression, right: Expression): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The dividend expression. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The divisor expression. A new representing the modulo operation. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The divisor expression. | + +Returns: + +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. + +### Example + -Returns: +```typescript +// Calculate the remainder of dividing 'field1' by 'field2'. +mod(field("field1"), field("field2")); -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +``` ### notEqual(left, right) {:#notequal_b3c3382} @@ -7758,12 +7244,6 @@ export declare function mod(left: Expression, right: Expression): FunctionExpres Creates an expression that checks if two expressions are not equal. -```typescript -// Check if the 'status' field is not equal to field 'finalState' -notEqual(field("status"), field("finalState")); - -``` - Signature: ```typescript @@ -7775,25 +7255,30 @@ export declare function notEqual(left: Expression, right: Expression): BooleanEx | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the inequality comparison. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### subtract(left, right) {:#subtract_b3c3382} +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts two expressions. ```typescript -// Subtract the 'discount' field from the 'price' field -subtract(field("price"), field("discount")); +// Check if the 'status' field is not equal to field 'finalState' +notEqual(field("status"), field("finalState")); ``` +### subtract(left, right) {:#subtract_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts two expressions. + Signature: ```typescript @@ -7805,12 +7290,23 @@ export declare function subtract(left: Expression, right: Expression): FunctionE | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract from. | -| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract. A new representing the subtraction operation. | +| right | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to subtract. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. + +### Example + + +```typescript +// Subtract the 'discount' field from the 'price' field +subtract(field("price"), field("discount")); + +``` + ## function(mapExpr, ...) ### mapRemove(mapExpr, key) {:#mapremove_23c7d51} @@ -7820,12 +7316,6 @@ export declare function subtract(left: Expression, right: Expression): FunctionE Creates an expression that removes a key from the map produced by evaluating an expression. -``` -// Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), 'baz'); - -``` - Signature: ```typescript @@ -7843,19 +7333,23 @@ export declare function mapRemove(mapExpr: Expression, key: string): FunctionExp [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### mapRemove(mapExpr, keyExpr) {:#mapremove_9fbcaa3} - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes a key from the map produced by evaluating an expression. ``` // Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), constant('baz')); +mapRemove(map({foo: 'bar', baz: true}), 'baz'); +@example ``` +### mapRemove(mapExpr, keyExpr) {:#mapremove_9fbcaa3} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes a key from the map produced by evaluating an expression. + Signature: ```typescript @@ -7873,6 +7367,16 @@ export declare function mapRemove(mapExpr: Expression, keyExpr: Expression): Fun [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +### Example + + +``` +// Removes the key 'baz' from the input map. +mapRemove(map({foo: 'bar', baz: true}), constant('baz')); +@example + +``` + ## function(mapExpression, ...) ### mapGet(mapExpression, subField) {:#mapget_688c050} @@ -7882,12 +7386,6 @@ export declare function mapRemove(mapExpr: Expression, keyExpr: Expression): Fun Accesses a value from a map (object) expression using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -mapGet(field("address"), "city"); - -``` - Signature: ```typescript @@ -7899,12 +7397,23 @@ export declare function mapGet(mapExpression: Expression, subField: string): Fun | Parameter | Type | Description | | --- | --- | --- | | mapExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the map. | -| subField | string | The key to access in the map. A new representing the value associated with the given key in the map. | +| subField | string | The key to access in the map. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the value associated with the given key in the map. + +### Example + + +```typescript +// Get the 'city' value from the 'address' map field +mapGet(field("address"), "city"); + +``` + ## function(mapField, ...) ### mapMerge(mapField, secondMap, otherMaps) {:#mapmerge_70a564b} @@ -7914,13 +7423,6 @@ export declare function mapGet(mapExpression: Expression, subField: string): Fun Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge('settings', { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - Signature: ```typescript @@ -7939,6 +7441,16 @@ export declare function mapMerge(mapField: string, secondMap: Record This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -7946,12 +7458,6 @@ export declare function mapMerge(mapField: string, secondMap: RecordSignature: ```typescript @@ -7969,19 +7475,22 @@ export declare function mapRemove(mapField: string, key: string): FunctionExpres [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### mapRemove(mapField, keyExpr) {:#mapremove_8406d13} - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes a key from the map at the specified field name. ``` // Removes the key 'city' field from the map in the address field of the input document. -mapRemove('address', constant('city')); +mapRemove('address', 'city'); ``` +### mapRemove(mapField, keyExpr) {:#mapremove_8406d13} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes a key from the map at the specified field name. + Signature: ```typescript @@ -7999,6 +7508,15 @@ export declare function mapRemove(mapField: string, keyExpr: Expression): Functi [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +### Example + + +``` +// Removes the key 'city' field from the map in the address field of the input document. +mapRemove('address', constant('city')); + +``` + ## function(name, ...) ### field(name) {:#field_1eaaff4} @@ -8006,19 +7524,10 @@ export declare function mapRemove(mapField: string, keyExpr: Expression): Functi > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates a instance representing the field at the given path. +Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path. The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city"). -```typescript -// Create a Field instance for the 'title' field -const titleField = field("title"); - -// Create a Field instance for a nested field 'author.firstName' -const authorFirstNameField = field("author.firstName"); - -``` - Signature: ```typescript @@ -8029,12 +7538,26 @@ export declare function field(name: string): Field; | Parameter | Type | Description | | --- | --- | --- | -| name | string | The path to the field. A new instance representing the specified field. | +| name | string | The path to the field. | Returns: [Field](./firestore_lite_pipelines.field.md#field_class) +A new [Field](./firestore_pipelines.field.md#field_class) instance representing the specified field. + +### Example + + +```typescript +// Create a Field instance for the 'title' field +const titleField = field("title"); + +// Create a Field instance for a nested field 'author.firstName' +const authorFirstNameField = field("author.firstName"); + +``` + ## function(path, ...) ### field(path) {:#field_34ee07d} @@ -8042,7 +7565,7 @@ export declare function field(name: string): Field; > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates a instance representing the field at the given path. +Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path. Signature: @@ -8054,12 +7577,14 @@ export declare function field(path: FieldPath): Field; | Parameter | Type | Description | | --- | --- | --- | -| path | [FieldPath](./firestore_lite.fieldpath.md#fieldpath_class) | A FieldPath specifying the field. A new instance representing the specified field. | +| path | [FieldPath](./firestore_lite.fieldpath.md#fieldpath_class) | A FieldPath specifying the field. | Returns: [Field](./firestore_lite_pipelines.field.md#field_class) +A new [Field](./firestore_pipelines.field.md#field_class) instance representing the specified field. + ## function(pipeline, ...) ### execute(pipeline) {:#execute_01df620} @@ -8071,11 +7596,30 @@ Executes this pipeline and returns a Promise to represent the asynchronous opera The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously. -The pipeline results are returned as a that contains a list of objects. Each typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example: +The pipeline results are returned as a [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) that contains a list of [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects. Each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example: + +

  • If there are no stages or only transformation stages, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a single document.
  • If there is an aggregation, only a single [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a distinct group and its associated aggregated values.
+ +Signature: + +```typescript +export declare function execute(pipeline: Pipeline): Promise; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| pipeline | [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) | The pipeline to execute. | + +Returns: + +Promise<[PipelineSnapshot](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshot_class)> + +A Promise representing the asynchronous pipeline execution. -
  • If there are no stages or only transformation stages, each represents a single document.
  • If there is an aggregation, only a single is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each represents a distinct group and its associated aggregated values.
+### Example -

Example: ```typescript const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") @@ -8086,30 +7630,35 @@ const results: PipelineResults = snapshot.results; ``` +## function(stringExpression, ...) + +### charLength(stringExpression) {:#charlength_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the character length of a string expression in UTF-8. + Signature: ```typescript -export declare function execute(pipeline: Pipeline): Promise; +export declare function charLength(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pipeline | [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) | The pipeline to execute. A Promise representing the asynchronous pipeline execution. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to calculate the length of. | Returns: -Promise<[PipelineSnapshot](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshot_class)> - -## function(stringExpression, ...) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### charLength(stringExpression) {:#charlength_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the character length of a string expression in UTF-8. ```typescript // Get the character length of the 'name' field in UTF-8. @@ -8117,28 +7666,34 @@ strLength(field("name")); ``` +### endsWith(stringExpression, suffix) {:#endswith_0a0b889} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression ends with a given postfix. + Signature: ```typescript -export declare function charLength(stringExpression: Expression): FunctionExpression; +export declare function endsWith(stringExpression: Expression, suffix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to calculate the length of. A new representing the length of the string. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | +| suffix | string | The postfix to check for. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(stringExpression, suffix) {:#endswith_0a0b889} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression ends with a given postfix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." @@ -8146,10 +7701,17 @@ endsWith(field("fullName"), "Jr."); ``` +### endsWith(stringExpression, suffix) {:#endswith_13aee0d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression ends with a given postfix. + Signature: ```typescript -export declare function endsWith(stringExpression: Expression, suffix: string): BooleanExpression; +export declare function endsWith(stringExpression: Expression, suffix: Expression): BooleanExpression; ``` #### Parameters @@ -8157,18 +7719,16 @@ export declare function endsWith(stringExpression: Expression, suffix: string): | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | -| suffix | string | The postfix to check for. A new representing the 'ends with' comparison. | +| suffix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The postfix to check for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(stringExpression, suffix) {:#endswith_13aee0d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression ends with a given postfix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." @@ -8176,29 +7736,34 @@ endsWith(field("fullName"), constant("Jr.")); ``` +### like(stringExpression, pattern) {:#like_a84c581} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison. + Signature: ```typescript -export declare function endsWith(stringExpression: Expression, suffix: Expression): BooleanExpression; +export declare function like(stringExpression: Expression, pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | -| suffix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The postfix to check for. A new representing the 'ends with' comparison. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | +| pattern | string | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### like(stringExpression, pattern) {:#like_a84c581} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison. ```typescript // Check if the 'title' field contains the string "guide" @@ -8206,10 +7771,17 @@ like(field("title"), "%guide%"); ``` +### like(stringExpression, pattern) {:#like_b534848} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison. + Signature: ```typescript -export declare function like(stringExpression: Expression, pattern: string): BooleanExpression; +export declare function like(stringExpression: Expression, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -8217,29 +7789,34 @@ export declare function like(stringExpression: Expression, pattern: string): Boo | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | string | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### like(stringExpression, pattern) {:#like_b534848} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison. ```typescript // Check if the 'title' field contains the string "guide" like(field("title"), field("pattern")); -``` +``` + +### regexContains(stringExpression, pattern) {:#regexcontains_a84c581} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a specified regular expression as a substring. Signature: ```typescript -export declare function like(stringExpression: Expression, pattern: Expression): BooleanExpression; +export declare function regexContains(stringExpression: Expression, pattern: string): BooleanExpression; ``` #### Parameters @@ -8247,18 +7824,16 @@ export declare function like(stringExpression: Expression, pattern: Expression): | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| pattern | string | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(stringExpression, pattern) {:#regexcontains_a84c581} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) @@ -8266,10 +7841,17 @@ regexContains(field("description"), "(?i)example"); ``` +### regexContains(stringExpression, pattern) {:#regexcontains_b534848} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a specified regular expression as a substring. + Signature: ```typescript -export declare function regexContains(stringExpression: Expression, pattern: string): BooleanExpression; +export declare function regexContains(stringExpression: Expression, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -8277,18 +7859,16 @@ export declare function regexContains(stringExpression: Expression, pattern: str | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | string | The regular expression to use for the search. A new representing the 'contains' comparison. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(stringExpression, pattern) {:#regexcontains_b534848} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) @@ -8296,29 +7876,34 @@ regexContains(field("description"), field("pattern")); ``` +### regexMatch(stringExpression, pattern) {:#regexmatch_a84c581} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression matches a specified regular expression. + Signature: ```typescript -export declare function regexContains(stringExpression: Expression, pattern: Expression): BooleanExpression; +export declare function regexMatch(stringExpression: Expression, pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the search. A new representing the 'contains' comparison. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to match against. | +| pattern | string | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(stringExpression, pattern) {:#regexmatch_a84c581} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -8326,10 +7911,17 @@ regexMatch(field("email"), "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); ``` +### regexMatch(stringExpression, pattern) {:#regexmatch_b534848} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression matches a specified regular expression. + Signature: ```typescript -export declare function regexMatch(stringExpression: Expression, pattern: string): BooleanExpression; +export declare function regexMatch(stringExpression: Expression, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -8337,18 +7929,16 @@ export declare function regexMatch(stringExpression: Expression, pattern: string | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to match against. | -| pattern | string | The regular expression to use for the match. A new representing the regular expression match. | +| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(stringExpression, pattern) {:#regexmatch_b534848} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -8356,29 +7946,33 @@ regexMatch(field("email"), field("pattern")); ``` +### reverse(stringExpression) {:#reverse_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string. + Signature: ```typescript -export declare function regexMatch(stringExpression: Expression, pattern: Expression): BooleanExpression; +export declare function reverse(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to match against. | -| pattern | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The regular expression to use for the match. A new representing the regular expression match. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### reverse(stringExpression) {:#reverse_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string. ```typescript // Reverse the value of the 'myString' field. @@ -8386,28 +7980,34 @@ reverse(field("myString")); ``` +### startsWith(stringExpression, prefix) {:#startswith_75c3dbb} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression starts with a given prefix. + Signature: ```typescript -export declare function reverse(stringExpression: Expression): FunctionExpression; +export declare function startsWith(stringExpression: Expression, prefix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. A new representing the reversed string. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | +| prefix | string | The prefix to check for. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### startsWith(stringExpression, prefix) {:#startswith_75c3dbb} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression starts with a given prefix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." @@ -8415,10 +8015,17 @@ startsWith(field("fullName"), "Mr."); ``` +### startsWith(stringExpression, prefix) {:#startswith_52f218a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression starts with a given prefix. + Signature: ```typescript -export declare function startsWith(stringExpression: Expression, prefix: string): BooleanExpression; +export declare function startsWith(stringExpression: Expression, prefix: Expression): BooleanExpression; ``` #### Parameters @@ -8426,18 +8033,16 @@ export declare function startsWith(stringExpression: Expression, prefix: string) | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | -| prefix | string | The prefix to check for. A new representing the 'starts with' comparison. | +| prefix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The prefix to check for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### startsWith(stringExpression, prefix) {:#startswith_52f218a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression starts with a given prefix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." @@ -8445,29 +8050,34 @@ startsWith(field("fullName"), field("prefix")); ``` +### stringContains(stringExpression, substring) {:#stringcontains_3e9ff32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a specified substring. + Signature: ```typescript -export declare function startsWith(stringExpression: Expression, prefix: Expression): BooleanExpression; +export declare function stringContains(stringExpression: Expression, substring: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | -| prefix | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The prefix to check for. A new representing the 'starts with' comparison. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | +| substring | string | The substring to search for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### stringContains(stringExpression, substring) {:#stringcontains_3e9ff32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a specified substring. ```typescript // Check if the 'description' field contains "example". @@ -8475,10 +8085,17 @@ stringContains(field("description"), "example"); ``` +### stringContains(stringExpression, substring) {:#stringcontains_cc6ee02} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a substring specified by another expression. + Signature: ```typescript -export declare function stringContains(stringExpression: Expression, substring: string): BooleanExpression; +export declare function stringContains(stringExpression: Expression, substring: Expression): BooleanExpression; ``` #### Parameters @@ -8486,18 +8103,16 @@ export declare function stringContains(stringExpression: Expression, substring: | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| substring | string | The substring to search for. A new representing the 'contains' comparison. | +| substring | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the substring to search for. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### stringContains(stringExpression, substring) {:#stringcontains_cc6ee02} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a substring specified by another expression. ```typescript // Check if the 'description' field contains the value of the 'keyword' field. @@ -8505,29 +8120,33 @@ stringContains(field("description"), field("keyword")); ``` +### stringReverse(stringExpression) {:#stringreverse_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string. + Signature: ```typescript -export declare function stringContains(stringExpression: Expression, substring: Expression): BooleanExpression; +export declare function stringReverse(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| substring | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the substring to search for. A new representing the 'contains' comparison. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. | Returns: -[BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### stringReverse(stringExpression) {:#stringreverse_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string. ```typescript // Reverse the value of the 'myString' field. @@ -8535,28 +8154,33 @@ strReverse(field("myString")); ``` +### toLower(stringExpression) {:#tolower_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string expression to lowercase. + Signature: ```typescript -export declare function stringReverse(stringExpression: Expression): FunctionExpression; +export declare function toLower(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. A new representing the reversed string. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to convert to lowercase. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### toLower(stringExpression) {:#tolower_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the lowercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string expression to lowercase. ```typescript // Convert the 'name' field to lowercase @@ -8564,28 +8188,33 @@ toLower(field("name")); ``` +### toUpper(stringExpression) {:#toupper_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string expression to uppercase. + Signature: ```typescript -export declare function toLower(stringExpression: Expression): FunctionExpression; +export declare function toUpper(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to convert to lowercase. A new representing the lowercase string. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to convert to uppercase. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### toUpper(stringExpression) {:#toupper_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the uppercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string expression to uppercase. ```typescript // Convert the 'title' field to uppercase @@ -8593,28 +8222,34 @@ toUppercase(field("title")); ``` +### trim(stringExpression, valueToTrim) {:#trim_dd54322} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes leading and trailing characters from a string or byte array expression. + Signature: ```typescript -export declare function toUpper(stringExpression: Expression): FunctionExpression; +export declare function trim(stringExpression: Expression, valueToTrim?: string | Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string to convert to uppercase. A new representing the uppercase string. | +| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string or byte array to trim. | +| valueToTrim | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### trim(stringExpression, valueToTrim) {:#trim_dd54322} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the trimmed string or byte array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes leading and trailing characters from a string or byte array expression. ```typescript // Trim whitespace from the 'userInput' field @@ -8625,23 +8260,6 @@ trim(field("userInput"), '"'); ``` -Signature: - -```typescript -export declare function trim(stringExpression: Expression, valueToTrim?: string | Expression): FunctionExpression; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| stringExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the string or byte array to trim. | -| valueToTrim | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. A new representing the trimmed string or byte array. | - -Returns: - -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) - ## function(timestamp, ...) ### timestampAdd(timestamp, unit, amount) {:#timestampadd_98418f9} @@ -8651,12 +8269,6 @@ export declare function trim(stringExpression: Expression, valueToTrim?: string Creates an expression that adds a specified amount of time to a timestamp. -```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -timestampAdd(field("timestamp"), field("unit"), field("amount")); - -``` - Signature: ```typescript @@ -8669,25 +8281,30 @@ export declare function timestampAdd(timestamp: Expression, unit: Expression, am | --- | --- | --- | | timestamp | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampAdd(timestamp, unit, amount) {:#timestampadd_ffe8e57} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to a timestamp. ```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd(field("timestamp"), "day", 1); +// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. +timestampAdd(field("timestamp"), field("unit"), field("amount")); ``` +### timestampAdd(timestamp, unit, amount) {:#timestampadd_ffe8e57} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to a timestamp. + Signature: ```typescript @@ -8700,25 +8317,30 @@ export declare function timestampAdd(timestamp: Expression, unit: 'microsecond' | --- | --- | --- | | timestamp | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to add (e.g., "day", "hour"). | -| amount | number | The amount of time to add. A new representing the resulting timestamp. | +| amount | number | The amount of time to add. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### timestampSubtract(timestamp, unit, amount) {:#timestampsubtract_98418f9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from a timestamp. ```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -timestampSubtract(field("timestamp"), field("unit"), field("amount")); +// Add 1 day to the 'timestamp' field. +timestampAdd(field("timestamp"), "day", 1); ``` +### timestampSubtract(timestamp, unit, amount) {:#timestampsubtract_98418f9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from a timestamp. + Signature: ```typescript @@ -8731,11 +8353,22 @@ export declare function timestampSubtract(timestamp: Expression, unit: Expressio | --- | --- | --- | | timestamp | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: -[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +[FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. + +### Example + + +```typescript +// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. +timestampSubtract(field("timestamp"), field("unit"), field("amount")); + +``` ### timestampSubtract(timestamp, unit, amount) {:#timestampsubtract_ffe8e57} @@ -8744,12 +8377,6 @@ export declare function timestampSubtract(timestamp: Expression, unit: Expressio Creates an expression that subtracts a specified amount of time from a timestamp. -```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract(field("timestamp"), "day", 1); - -``` - Signature: ```typescript @@ -8762,12 +8389,23 @@ export declare function timestampSubtract(timestamp: Expression, unit: 'microsec | --- | --- | --- | | timestamp | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to subtract (e.g., "day", "hour"). | -| amount | number | The amount of time to subtract. A new representing the resulting timestamp. | +| amount | number | The amount of time to subtract. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. + +### Example + + +```typescript +// Subtract 1 day from the 'timestamp' field. +timestampSubtract(field("timestamp"), "day", 1); + +``` + ## function(timestampExpression, ...) ### timestampTruncate(timestampExpression, granularity, timezone) {:#timestamptruncate_ad5d843} @@ -8789,12 +8427,14 @@ export declare function timestampTruncate(timestampExpression: Expression, granu | --- | --- | --- | | timestampExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Truncate the timestamp value that is returned by this expression. | | granularity | [TimeGranularity](./firestore_lite_pipelines.md#timegranularity) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -8823,12 +8463,14 @@ export declare function timestampTruncate(timestampExpression: Expression, granu | --- | --- | --- | | timestampExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | Truncate the timestamp value that is returned by this expression. | | granularity | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -8849,13 +8491,6 @@ Creates an expression that returns the `catch` argument if there is an error, el This overload is useful when a BooleanExpression is required. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -ifError(constant(50).divide('length').gt(1), constant(false)); - -``` - Signature: ```typescript @@ -8867,26 +8502,31 @@ export declare function ifError(tryExpr: BooleanExpression, catchExpr: BooleanEx | Parameter | Type | Description | | --- | --- | --- | | tryExpr | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The try expression. | -| catchExpr | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. A new representing the 'ifError' operation. | +| catchExpr | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### ifError(tryExpr, catchExpr) {:#iferror_756c12e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. ```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -ifError(field("title").arrayGet(0), field("title")); +// Create an expression that protects against a divide by zero error +// but always returns a boolean expression. +ifError(constant(50).divide('length').gt(1), constant(false)); ``` +### ifError(tryExpr, catchExpr) {:#iferror_756c12e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. + Signature: ```typescript @@ -8898,26 +8538,31 @@ export declare function ifError(tryExpr: Expression, catchExpr: Expression): Fun | Parameter | Type | Description | | --- | --- | --- | | tryExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The try expression. | -| catchExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. A new representing the 'ifError' operation. | +| catchExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### ifError(tryExpr, catchValue) {:#iferror_dc532f9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. ```typescript // Returns the first item in the title field arrays, or returns -// "Default Title" -ifError(field("title").arrayGet(0), "Default Title"); +// the entire title field if the array is empty or the field is another type. +ifError(field("title").arrayGet(0), field("title")); ``` +### ifError(tryExpr, catchValue) {:#iferror_dc532f9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. + Signature: ```typescript @@ -8929,12 +8574,24 @@ export declare function ifError(tryExpr: Expression, catchValue: unknown): Funct | Parameter | Type | Description | | --- | --- | --- | | tryExpr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The try expression. | -| catchValue | unknown | The value that will be returned if the tryExpr produces an error. A new representing the 'ifError' operation. | +| catchValue | unknown | The value that will be returned if the tryExpr produces an error. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. + +### Example + + +```typescript +// Returns the first item in the title field arrays, or returns +// "Default Title" +ifError(field("title").arrayGet(0), "Default Title"); + +``` + ## function(value, ...) ### constant(value) {:#constant_0c00f91} @@ -8954,12 +8611,14 @@ export declare function constant(value: number): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | number | The number value. A new Constant instance. | +| value | number | The number value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_6dac335} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -8977,12 +8636,14 @@ export declare function constant(value: VectorValue): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The VectorValue value. A new Constant instance. | +| value | [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The VectorValue value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_7c807cd} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9000,12 +8661,14 @@ export declare function constant(value: string): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | string | The string value. A new Constant instance. | +| value | string | The string value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_b2e4f8d} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9023,12 +8686,14 @@ export declare function constant(value: boolean): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | boolean | The boolean value. A new Constant instance. | +| value | boolean | The boolean value. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +A new `Constant` instance. + ### constant(value) {:#constant_73ebd84} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9046,12 +8711,14 @@ export declare function constant(value: null): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | null | The null value. A new Constant instance. | +| value | null | The null value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_72a76cb} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9069,12 +8736,14 @@ export declare function constant(value: GeoPoint): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [GeoPoint](./firestore_lite.geopoint.md#geopoint_class) | The GeoPoint value. A new Constant instance. | +| value | [GeoPoint](./firestore_lite.geopoint.md#geopoint_class) | The GeoPoint value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_000477d} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9092,12 +8761,14 @@ export declare function constant(value: Timestamp): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | The Timestamp value. A new Constant instance. | +| value | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | The Timestamp value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_5131bf7} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9115,12 +8786,14 @@ export declare function constant(value: Date): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | Date | The Date value. A new Constant instance. | +| value | Date | The Date value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_fdf565d} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9138,12 +8811,14 @@ export declare function constant(value: Bytes): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Bytes](./firestore_lite.bytes.md#bytes_class) | The Bytes value. A new Constant instance. | +| value | [Bytes](./firestore_lite.bytes.md#bytes_class) | The Bytes value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_bcd2b0b} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9161,12 +8836,14 @@ export declare function constant(value: DocumentReference): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [DocumentReference](./firestore_lite.documentreference.md#documentreference_class) | The DocumentReference value. A new Constant instance. | +| value | [DocumentReference](./firestore_lite.documentreference.md#documentreference_class) | The DocumentReference value. | Returns: [Expression](./firestore_lite_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### exists(value) {:#exists_f3daf14} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9174,12 +8851,6 @@ export declare function constant(value: DocumentReference): Expression; Creates an expression that checks if a field exists. -```typescript -// Check if the document has a field named "phoneNumber" -exists(field("phoneNumber")); - -``` - Signature: ```typescript @@ -9190,25 +8861,30 @@ export declare function exists(value: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluates to the name of the field to check. A new representing the 'exists' check. | +| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An expression evaluates to the name of the field to check. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### isAbsent(value) {:#isabsent_f3daf14} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'exists' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns `true` if a value is absent. Otherwise, returns `false` even if the value is `null`. ```typescript -// Check if the field `value` is absent. -isAbsent(field("value")); +// Check if the document has a field named "phoneNumber" +exists(field("phoneNumber")); ``` +### isAbsent(value) {:#isabsent_f3daf14} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns `true` if a value is absent. Otherwise, returns `false` even if the value is `null`. + Signature: ```typescript @@ -9219,25 +8895,30 @@ export declare function isAbsent(value: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. A new representing the 'isAbsent' check. | +| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) -### isError(value) {:#iserror_f3daf14} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'isAbsent' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a given expression produces an error. ```typescript -// Check if the result of a calculation is an error -isError(field("title").arrayContains(1)); +// Check if the field `value` is absent. +isAbsent(field("value")); ``` +### isError(value) {:#iserror_f3daf14} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a given expression produces an error. + Signature: ```typescript @@ -9248,12 +8929,23 @@ export declare function isError(value: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. A new representing the 'isError' check. | +| value | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression to check. | Returns: [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'isError' check. + +### Example + + +```typescript +// Check if the result of a calculation is an error +isError(field("title").arrayContains(1)); + +``` + ## function(vectorExpression, ...) ### cosineDistance(vectorExpression, vector) {:#cosinedistance_3a80317} @@ -9263,12 +8955,6 @@ export declare function isError(value: Expression): BooleanExpression; Calculates the Cosine distance between a vector expression and a vector literal. -```typescript -// Calculate the cosine distance between the 'location' field and a target location -cosineDistance(field("location"), [37.7749, -122.4194]); - -``` - Signature: ```typescript @@ -9279,26 +8965,31 @@ export declare function cosineDistance(vectorExpression: Expression, vector: num | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. A new representing the cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### cosineDistance(vectorExpression, otherVectorExpression) {:#cosinedistance_17b5bcc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between two vector expressions. ```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -cosineDistance(field("userVector"), field("itemVector")); +// Calculate the cosine distance between the 'location' field and a target location +cosineDistance(field("location"), [37.7749, -122.4194]); ``` +### cosineDistance(vectorExpression, otherVectorExpression) {:#cosinedistance_17b5bcc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between two vector expressions. + Signature: ```typescript @@ -9309,26 +9000,31 @@ export declare function cosineDistance(vectorExpression: Expression, otherVector | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| otherVectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| otherVectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(vectorExpression, vector) {:#dotproduct_3a80317} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between a vector expression and a double array. ```typescript -// Calculate the dot product between a feature vector and a target vector -dotProduct(field("features"), [0.5, 0.8, 0.2]); +// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field +cosineDistance(field("userVector"), field("itemVector")); ``` +### dotProduct(vectorExpression, vector) {:#dotproduct_3a80317} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between a vector expression and a double array. + Signature: ```typescript @@ -9339,26 +9035,31 @@ export declare function dotProduct(vectorExpression: Expression, vector: number[ | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to calculate with. | -| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. A new representing the dot product between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to calculate with. | +| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(vectorExpression, otherVectorExpression) {:#dotproduct_17b5bcc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between two vector expressions. ```typescript -// Calculate the dot product between two document vectors: 'docVector1' and 'docVector2' -dotProduct(field("docVector1"), field("docVector2")); +// Calculate the dot product between a feature vector and a target vector +dotProduct(field("features"), [0.5, 0.8, 0.2]); ``` +### dotProduct(vectorExpression, otherVectorExpression) {:#dotproduct_17b5bcc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between two vector expressions. + Signature: ```typescript @@ -9369,27 +9070,31 @@ export declare function dotProduct(vectorExpression: Expression, otherVectorExpr | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to calculate with. | -| otherVectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to calculate with. A new representing the dot product between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to calculate with. | +| otherVectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to calculate with. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(vectorExpression, vector) {:#euclideandistance_3a80317} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between a vector expression and a double array. ```typescript -// Calculate the Euclidean distance between the 'location' field and a target location - -euclideanDistance(field("location"), [37.7749, -122.4194]); +// Calculate the dot product between two document vectors: 'docVector1' and 'docVector2' +dotProduct(field("docVector1"), field("docVector2")); ``` +### euclideanDistance(vectorExpression, vector) {:#euclideandistance_3a80317} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between a vector expression and a double array. + Signature: ```typescript @@ -9400,26 +9105,32 @@ export declare function euclideanDistance(vectorExpression: Expression, vector: | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. A new representing the Euclidean distance between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| vector | number\[\] \| [VectorValue](./firestore_lite.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(vectorExpression, otherVectorExpression) {:#euclideandistance_17b5bcc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between two vector expressions. ```typescript -// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' -euclideanDistance(field("pointA"), field("pointB")); +// Calculate the Euclidean distance between the 'location' field and a target location + +euclideanDistance(field("location"), [37.7749, -122.4194]); ``` +### euclideanDistance(vectorExpression, otherVectorExpression) {:#euclideandistance_17b5bcc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between two vector expressions. + Signature: ```typescript @@ -9430,26 +9141,31 @@ export declare function euclideanDistance(vectorExpression: Expression, otherVec | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| otherVectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the Euclidean distance between the two vectors. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| otherVectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) -### vectorLength(vectorExpression) {:#vectorlength_58a039b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a Firestore Vector. ```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength(field("embedding")); +// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' +euclideanDistance(field("pointA"), field("pointB")); ``` +### vectorLength(vectorExpression) {:#vectorlength_58a039b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a Firestore Vector. + Signature: ```typescript @@ -9460,18 +9176,29 @@ export declare function vectorLength(vectorExpression: Expression): FunctionExpr | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the Firestore Vector. A new representing the length of the array. | +| vectorExpression | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | The expression representing the Firestore Vector. | Returns: [FunctionExpression](./firestore_lite_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. + +### Example + + +```typescript +// Get the vector length (dimension) of the field 'embedding'. +vectorLength(field("embedding")); + +``` + ## AddFieldsStageOptions > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how an AddFieldsStage is evaluated. See . +Options defining how an AddFieldsStage is evaluated. See [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields). Signature: @@ -9486,7 +9213,7 @@ export declare type AddFieldsStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how an AggregateStage is evaluated. See . +Options defining how an AggregateStage is evaluated. See [Pipeline.aggregate()](./firestore_pipelines.pipeline.md#pipelineaggregate). Signature: @@ -9502,7 +9229,9 @@ export declare type AggregateStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Defines the configuration options for a within a pipeline. This type extends and provides specific settings for how a collection group is identified and processed during pipeline execution. +Defines the configuration options for a CollectionGroupStage within a pipeline. This type extends [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) and provides specific settings for how a collection group is identified and processed during pipeline execution. + +See [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) to create a collection group stage. Signature: @@ -9518,7 +9247,7 @@ export declare type CollectionGroupStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a CollectionStage is evaluated. See . +Options defining how a CollectionStage is evaluated. See [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection). Signature: @@ -9534,7 +9263,7 @@ export declare type CollectionStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a DatabaseStage is evaluated. See . +Options defining how a DatabaseStage is evaluated. See [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase). Signature: @@ -9547,7 +9276,7 @@ export declare type DatabaseStageOptions = StageOptions & {}; > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a DistinctStage is evaluated. See . +Options defining how a DistinctStage is evaluated. See [Pipeline.distinct()](./firestore_pipelines.pipeline.md#pipelinedistinct). Signature: @@ -9562,7 +9291,7 @@ export declare type DistinctStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a DocumentsStage is evaluated. See . +Options defining how a DocumentsStage is evaluated. See [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments). Signature: @@ -9590,7 +9319,7 @@ export declare type ExpressionType = 'Field' | 'Constant' | 'Function' | 'Aggreg > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a FindNearestStage is evaluated. See . +Options defining how a FindNearestStage is evaluated. See [Pipeline.findNearest()](./firestore_pipelines.pipeline.md#pipelinefindnearest). Signature: @@ -9609,7 +9338,7 @@ export declare type FindNearestStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a LimitStage is evaluated. See . +Options defining how a LimitStage is evaluated. See [Pipeline.limit()](./firestore_pipelines.pipeline.md#pipelinelimit). Signature: @@ -9624,7 +9353,7 @@ export declare type LimitStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how an OffsetStage is evaluated. See . +Options defining how an OffsetStage is evaluated. See [Pipeline.offset()](./firestore_pipelines.pipeline.md#pipelineoffset). Signature: @@ -9641,8 +9370,6 @@ export declare type OffsetStageOptions = StageOptions & { Utility type to create an type that only allows one property of the Type param T to be set. -type XorY = OneOf<{ x: unknown, y: unknown}> let a = { x: "foo" } // OK let b = { y: "foo" } // OK let c = { a: "foo", y: "foo" } // Not OK - Signature: ```typescript @@ -9653,6 +9380,17 @@ export declare type OneOf = { }[keyof T]; ``` +### Example + + +``` +type XorY = OneOf<{ x: unknown, y: unknown }> +let a = { x: "foo" } // OK +let b = { y: "foo" } // OK +let c = { a: "foo", y: "foo" } // Not OK + +``` + ## PartialWithFieldValue Similar to TypeScript's `Partial`, but allows nested fields to be omitted and FieldValues to be passed in as property values. @@ -9680,7 +9418,7 @@ export declare type Primitive = string | number | boolean | undefined | null; > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a RemoveFieldsStage is evaluated. See . +Options defining how a RemoveFieldsStage is evaluated. See [Pipeline.removeFields()](./firestore_pipelines.pipeline.md#pipelineremovefields). Signature: @@ -9695,7 +9433,7 @@ export declare type RemoveFieldsStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a ReplaceWithStage is evaluated. See . +Options defining how a ReplaceWithStage is evaluated. See [Pipeline.replaceWith()](./firestore_pipelines.pipeline.md#pipelinereplacewith). Signature: @@ -9710,9 +9448,9 @@ export declare type ReplaceWithStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Defines the options for evaluating a sample stage within a pipeline. This type combines common with a specific configuration where only one of the defined sampling methods can be applied. +Defines the options for evaluating a sample stage within a pipeline. This type combines common [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) with a specific configuration where only one of the defined sampling methods can be applied. -See to create a sample stage.. +See [Pipeline.sample()](./firestore_pipelines.pipeline.md#pipelinesample) to create a sample stage.. Signature: @@ -9728,7 +9466,7 @@ export declare type SampleStageOptions = StageOptions & OneOf<{ > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a SelectStage is evaluated. See . +Options defining how a SelectStage is evaluated. See [Pipeline.select()](./firestore_pipelines.pipeline.md#pipelineselect). Signature: @@ -9757,7 +9495,7 @@ export declare type SetOptions = { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a SortStage is evaluated. See . +Options defining how a SortStage is evaluated. See [Pipeline.sort()](./firestore_pipelines.pipeline.md#pipelinesort). Signature: @@ -9785,7 +9523,7 @@ export declare type TimeGranularity = 'microsecond' | 'millisecond' | 'second' | > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a UnionStage is evaluated. See . +Options defining how a UnionStage is evaluated. See [Pipeline.union()](./firestore_pipelines.pipeline.md#pipelineunion). Signature: @@ -9816,7 +9554,7 @@ export declare type UnnestStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a WhereStage is evaluated. See . +Options defining how a WhereStage is evaluated. See [Pipeline.where()](./firestore_pipelines.pipeline.md#pipelinewhere). Signature: diff --git a/docs-devsite/firestore_lite_pipelines.pipeline.md b/docs-devsite/firestore_lite_pipelines.pipeline.md index 9c3f65e046..e68ad20767 100644 --- a/docs-devsite/firestore_lite_pipelines.pipeline.md +++ b/docs-devsite/firestore_lite_pipelines.pipeline.md @@ -23,27 +23,6 @@ NOTE: The chained stages do not prescribe exactly how Firestore will execute the Usage Examples: -```typescript -const db: Firestore; // Assumes a valid firestore instance. - -// Example 1: Select specific fields and rename 'rating' to 'bookRating' -const results1 = await execute(db.pipeline() - .collection("books") - .select("title", "author", field("rating").as("bookRating"))); - -// Example 2: Filter documents where 'genre' is "Science Fiction" and 'published' is after 1950 -const results2 = await execute(db.pipeline() - .collection("books") - .where(and(field("genre").eq("Science Fiction"), field("published").gt(1950)))); - -// Example 3: Calculate the average rating of books published after 1980 -const results3 = await execute(db.pipeline() - .collection("books") - .where(field("published").gt(1980)) - .aggregate(avg(field("rating")).as("averageRating"))); - -``` - Signature: ```typescript @@ -54,66 +33,12 @@ export declare class Pipeline | Method | Modifiers | Description | | --- | --- | --- | -| [addFields(field, additionalFields)](./firestore_lite_pipelines.pipeline.md#pipelineaddfields) | | (Public Preview) Adds new fields to outputs from previous stages.This stage allows you to compute values on-the-fly based on existing data from previous stages or constants. You can use this to create new fields or overwrite existing ones (if there is name overlaps).The added fields are defined using s, which can be:- : References an existing document field. - : Either a literal value (see ) or a computed value (see ) with an assigned alias using .Example: -```typescript -firestore.pipeline().collection("books") - .addFields( - field("rating").as("bookRating"), // Rename 'rating' to 'bookRating' - add(5, field("quantity")).as("totalCost") // Calculate 'totalCost' - ); - -``` - | -| [addFields(options)](./firestore_lite_pipelines.pipeline.md#pipelineaddfields) | | (Public Preview) Adds new fields to outputs from previous stages.This stage allows you to compute values on-the-fly based on existing data from previous stages or constants. You can use this to create new fields or overwrite existing ones (if there is name overlaps).The added fields are defined using s, which can be:- : References an existing document field. - : Either a literal value (see ) or a computed value (see ) with an assigned alias using .Example: -```typescript -firestore.pipeline().collection("books") - .addFields( - field("rating").as("bookRating"), // Rename 'rating' to 'bookRating' - add(5, field("quantity")).as("totalCost") // Calculate 'totalCost' - ); - -``` - | -| [aggregate(accumulator, additionalAccumulators)](./firestore_lite_pipelines.pipeline.md#pipelineaggregate) | | (Public Preview) Performs aggregation operations on the documents from previous stages.

This stage allows you to calculate aggregate values over a set of documents. You define the aggregations to perform using expressions which are typically results of calling on instances.

Example: -```typescript -// Calculate the average rating and the total number of books -firestore.pipeline().collection("books") - .aggregate( - field("rating").avg().as("averageRating"), - countAll().as("totalBooks") - ); - -``` - | -| [aggregate(options)](./firestore_lite_pipelines.pipeline.md#pipelineaggregate) | | (Public Preview) Performs optionally grouped aggregation operations on the documents from previous stages.

This stage allows you to calculate aggregate values over a set of documents, optionally grouped by one or more fields or functions. You can specify:

  • \*\*Grouping Fields or Functions:\*\* One or more fields or functions to group the documents by. For each distinct combination of values in these fields, a separate group is created. If no grouping fields are provided, a single group containing all documents is used. Not specifying groups is the same as putting the entire inputs into one group.
  • \*\*Accumulators:\*\* One or more accumulation operations to perform within each group. These are defined using expressions, which are typically created by calling on instances. Each aggregation calculates a value (e.g., sum, average, count) based on the documents within its group.

Example: -```typescript -// Calculate the average rating for each genre. -firestore.pipeline().collection("books") - .aggregate({ - accumulators: [avg(field("rating")).as("avg_rating")] - groups: ["genre"] - }); - -``` - | -| [distinct(group, additionalGroups)](./firestore_lite_pipelines.pipeline.md#pipelinedistinct) | | (Public Preview) Returns a set of distinct values from the inputs to this stage.This stage runs through the results from previous stages to include only results with unique combinations of values (, , etc).The parameters to this stage are defined using expressions or strings:- : Name of an existing field - : References an existing document field. - : Represents the result of a function with an assigned alias name using .Example: -```typescript -// Get a list of unique author names in uppercase and genre combinations. -firestore.pipeline().collection("books") - .distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt") - .select("authorName"); - -``` - | -| [distinct(options)](./firestore_lite_pipelines.pipeline.md#pipelinedistinct) | | (Public Preview) Returns a set of distinct values from the inputs to this stage.This stage runs through the results from previous stages to include only results with unique combinations of values (, , etc).The parameters to this stage are defined using expressions or strings:- : Name of an existing field - : References an existing document field. - : Represents the result of a function with an assigned alias name using .Example: -```typescript -// Get a list of unique author names in uppercase and genre combinations. -firestore.pipeline().collection("books") - .distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt") - .select("authorName"); - -``` - | +| [addFields(field, additionalFields)](./firestore_lite_pipelines.pipeline.md#pipelineaddfields) | | (Public Preview) Adds new fields to outputs from previous stages.This stage allows you to compute values on-the-fly based on existing data from previous stages or constants. You can use this to create new fields or overwrite existing ones (if there is name overlaps).The added fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface)s, which can be:- [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [Expression](./firestore_pipelines.expression.md#expression_class): Either a literal value (see [constant()](./firestore_pipelines.md#constant_0c00f91)) or a computed value with an assigned alias using [Expression.as()](./firestore_pipelines.expression.md#expressionas).Example: | +| [addFields(options)](./firestore_lite_pipelines.pipeline.md#pipelineaddfields) | | (Public Preview) Adds new fields to outputs from previous stages.This stage allows you to compute values on-the-fly based on existing data from previous stages or constants. You can use this to create new fields or overwrite existing ones (if there is name overlaps).The added fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface)s, which can be:- [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [Expression](./firestore_pipelines.expression.md#expression_class): Either a literal value (see [constant()](./firestore_pipelines.md#constant_0c00f91)) or a computed value with an assigned alias using [Expression.as()](./firestore_pipelines.expression.md#expressionas).Example: | +| [aggregate(accumulator, additionalAccumulators)](./firestore_lite_pipelines.pipeline.md#pipelineaggregate) | | (Public Preview) Performs aggregation operations on the documents from previous stages.

This stage allows you to calculate aggregate values over a set of documents. You define the aggregations to perform using [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) expressions which are typically results of calling [Expression.as()](./firestore_pipelines.expression.md#expressionas) on [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) instances.

Example: | +| [aggregate(options)](./firestore_lite_pipelines.pipeline.md#pipelineaggregate) | | (Public Preview) Performs optionally grouped aggregation operations on the documents from previous stages.

This stage allows you to calculate aggregate values over a set of documents, optionally grouped by one or more fields or functions. You can specify:

  • \*\*Grouping Fields or Functions:\*\* One or more fields or functions to group the documents by. For each distinct combination of values in these fields, a separate group is created. If no grouping fields are provided, a single group containing all documents is used. Not specifying groups is the same as putting the entire inputs into one group.
  • \*\*Accumulators:\*\* One or more accumulation operations to perform within each group. These are defined using [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) expressions, which are typically created by calling [Expression.as()](./firestore_pipelines.expression.md#expressionas) on [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) instances. Each aggregation calculates a value (e.g., sum, average, count) based on the documents within its group.

Example: | +| [distinct(group, additionalGroups)](./firestore_lite_pipelines.pipeline.md#pipelinedistinct) | | (Public Preview) Returns a set of distinct values from the inputs to this stage.This stage runs through the results from previous stages to include only results with unique combinations of [Expression](./firestore_pipelines.expression.md#expression_class) values ([Field](./firestore_pipelines.field.md#field_class), [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class), etc).The parameters to this stage are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions or strings:- string: Name of an existing field - [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas).Example: | +| [distinct(options)](./firestore_lite_pipelines.pipeline.md#pipelinedistinct) | | (Public Preview) Returns a set of distinct values from the inputs to this stage.This stage runs through the results from previous stages to include only results with unique combinations of [Expression](./firestore_pipelines.expression.md#expression_class) values ([Field](./firestore_pipelines.field.md#field_class), [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class), etc).The parameters to this stage are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions or strings:- string: Name of an existing field - [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas).Example: | | [findNearest(options)](./firestore_lite_pipelines.pipeline.md#pipelinefindnearest) | | (Public Preview) Performs a vector proximity search on the documents from the previous stage, returning the K-nearest documents based on the specified query vectorValue and distanceMeasure. The returned documents will be sorted in order from nearest to furthest from the query vectorValue.

Example: ```typescript // Find the 10 most similar books based on the book description. @@ -131,278 +56,74 @@ firestore.pipeline().collection("books") ``` | -| [limit(limit)](./firestore_lite_pipelines.pipeline.md#pipelinelimit) | | (Public Preview) Limits the maximum number of documents returned by previous stages to limit.

This stage is particularly useful when you want to retrieve a controlled subset of data from a potentially large result set. It's often used for:

  • \*\*Pagination:\*\* In combination with to retrieve specific pages of results.
  • \*\*Limiting Data Retrieval:\*\* To prevent excessive data transfer and improve performance, especially when dealing with large collections.

Example: -```typescript -// Limit the results to the top 10 highest-rated books -firestore.pipeline().collection('books') - .sort(field('rating').descending()) - .limit(10); - -``` - | -| [limit(options)](./firestore_lite_pipelines.pipeline.md#pipelinelimit) | | (Public Preview) Limits the maximum number of documents returned by previous stages to limit.

This stage is particularly useful when you want to retrieve a controlled subset of data from a potentially large result set. It's often used for:

  • \*\*Pagination:\*\* In combination with to retrieve specific pages of results.
  • \*\*Limiting Data Retrieval:\*\* To prevent excessive data transfer and improve performance, especially when dealing with large collections.

Example: -```typescript -// Limit the results to the top 10 highest-rated books -firestore.pipeline().collection('books') - .sort(field('rating').descending()) - .limit(10); +| [limit(limit)](./firestore_lite_pipelines.pipeline.md#pipelinelimit) | | (Public Preview) Limits the maximum number of documents returned by previous stages to limit.

This stage is particularly useful when you want to retrieve a controlled subset of data from a potentially large result set. It's often used for:

  • \*\*Pagination:\*\* In combination with to retrieve specific pages of results.
  • \*\*Limiting Data Retrieval:\*\* To prevent excessive data transfer and improve performance, especially when dealing with large collections.

Example: | +| [limit(options)](./firestore_lite_pipelines.pipeline.md#pipelinelimit) | | (Public Preview) Limits the maximum number of documents returned by previous stages to limit.

This stage is particularly useful when you want to retrieve a controlled subset of data from a potentially large result set. It's often used for:

  • \*\*Pagination:\*\* In combination with to retrieve specific pages of results.
  • \*\*Limiting Data Retrieval:\*\* To prevent excessive data transfer and improve performance, especially when dealing with large collections.

Example: | +| [offset(offset)](./firestore_lite_pipelines.pipeline.md#pipelineoffset) | | (Public Preview) Skips the first offset number of documents from the results of previous stages.

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve results in chunks. It is typically used in conjunction with to control the size of each page.

Example: | +| [offset(options)](./firestore_lite_pipelines.pipeline.md#pipelineoffset) | | (Public Preview) Skips the first offset number of documents from the results of previous stages.

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve results in chunks. It is typically used in conjunction with to control the size of each page.

Example: | +| [rawStage(name, params, options)](./firestore_lite_pipelines.pipeline.md#pipelinerawstage) | | (Public Preview) Adds a raw stage to the pipeline.

This method provides a flexible way to extend the pipeline's functionality by adding custom stages. Each raw stage is defined by a unique name and a set of params that control its behavior.

Example (Assuming there is no 'where' stage available in SDK): | +| [removeFields(fieldValue, additionalFields)](./firestore_lite_pipelines.pipeline.md#pipelineremovefields) | | (Public Preview) Remove fields from outputs of previous stages.Example: | +| [removeFields(options)](./firestore_lite_pipelines.pipeline.md#pipelineremovefields) | | (Public Preview) Remove fields from outputs of previous stages.Example: | +| [replaceWith(fieldName)](./firestore_lite_pipelines.pipeline.md#pipelinereplacewith) | | (Public Preview) Fully overwrites all fields in a document with those coming from a nested map.

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value.

Example: | +| [replaceWith(expr)](./firestore_lite_pipelines.pipeline.md#pipelinereplacewith) | | (Public Preview) Fully overwrites all fields in a document with those coming from a map.

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value.

Example: | +| [replaceWith(options)](./firestore_lite_pipelines.pipeline.md#pipelinereplacewith) | | (Public Preview) Fully overwrites all fields in a document with those coming from a map.

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value.

Example: | +| [sample(documents)](./firestore_lite_pipelines.pipeline.md#pipelinesample) | | (Public Preview) Performs a pseudo-random sampling of the documents from the previous stage.

This stage will filter documents pseudo-randomly. The parameter specifies how number of documents to be returned.

Examples: | +| [sample(options)](./firestore_lite_pipelines.pipeline.md#pipelinesample) | | (Public Preview) Performs a pseudo-random sampling of the documents from the previous stage.

This stage will filter documents pseudo-randomly. The 'options' parameter specifies how sampling will be performed. See [SampleStageOptions](./firestore_pipelines.md#samplestageoptions) for more information. | +| [select(selection, additionalSelections)](./firestore_lite_pipelines.pipeline.md#pipelineselect) | | (Public Preview) Selects or creates a set of fields from the outputs of previous stages.

The selected fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions, which can be:

  • string : Name of an existing field
  • [Field](./firestore_pipelines.field.md#field_class): References an existing field.
  • [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas)

If no selections are provided, the output of this stage is empty. Use [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields) instead if only additions are desired.

Example: | +| [select(options)](./firestore_lite_pipelines.pipeline.md#pipelineselect) | | (Public Preview) Selects or creates a set of fields from the outputs of previous stages.

The selected fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions, which can be:

  • string: Name of an existing field
  • [Field](./firestore_pipelines.field.md#field_class): References an existing field.
  • [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas)

If no selections are provided, the output of this stage is empty. Use [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields) instead if only additions are desired.

Example: | +| [sort(ordering, additionalOrderings)](./firestore_lite_pipelines.pipeline.md#pipelinesort) | | (Public Preview) Sorts the documents from previous stages based on one or more [Ordering](./firestore_pipelines.ordering.md#ordering_class) criteria.

This stage allows you to order the results of your pipeline. You can specify multiple [Ordering](./firestore_pipelines.ordering.md#ordering_class) instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified.

Example: | +| [sort(options)](./firestore_lite_pipelines.pipeline.md#pipelinesort) | | (Public Preview) Sorts the documents from previous stages based on one or more [Ordering](./firestore_pipelines.ordering.md#ordering_class) criteria.

This stage allows you to order the results of your pipeline. You can specify multiple [Ordering](./firestore_pipelines.ordering.md#ordering_class) instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified.

Example: | +| [union(other)](./firestore_lite_pipelines.pipeline.md#pipelineunion) | | (Public Preview) Performs union of all documents from two pipelines, including duplicates.

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the other [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) given in parameter. The order of documents emitted from this stage is undefined.

Example: | +| [union(options)](./firestore_lite_pipelines.pipeline.md#pipelineunion) | | (Public Preview) Performs union of all documents from two pipelines, including duplicates.

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the other [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) given in parameter. The order of documents emitted from this stage is undefined.

Example: | +| [unnest(selectable, indexField)](./firestore_lite_pipelines.pipeline.md#pipelineunnest) | | (Public Preview) Produces a document for each element in an input array.For each previous stage document, this stage will emit zero or more augmented documents. The input array specified by the selectable parameter, will emit an augmented document for each input array element. The input array element will augment the previous stage document by setting the alias field with the array element value.When selectable evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for the current input document, returning it as is with the alias field absent.No documents are emitted when selectable evaluates to an empty array.Example: | +| [unnest(options)](./firestore_lite_pipelines.pipeline.md#pipelineunnest) | | (Public Preview) Produces a document for each element in an input array.For each previous stage document, this stage will emit zero or more augmented documents. The input array specified by the selectable parameter, will emit an augmented document for each input array element. The input array element will augment the previous stage document by setting the alias field with the array element value.When selectable evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for the current input document, returning it as is with the alias field absent.No documents are emitted when selectable evaluates to an empty array.Example: | +| [where(condition)](./firestore_lite_pipelines.pipeline.md#pipelinewhere) | | (Public Preview) Filters the documents from previous stages to only include those matching the specified [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class).

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class), typically including but not limited to:

  • field comparators: [Expression.equal()](./firestore_pipelines.expression.md#expressionequal), [Expression.lessThan()](./firestore_pipelines.expression.md#expressionlessthan), [Expression.greaterThan()](./firestore_pipelines.expression.md#expressiongreaterthan), etc.
  • logical operators: , , , etc.
  • advanced functions: [Expression.regexMatch()](./firestore_pipelines.expression.md#expressionregexmatch), [Expression.arrayContains()](./firestore_pipelines.expression.md#expressionarraycontains), etc.

Example: | +| [where(options)](./firestore_lite_pipelines.pipeline.md#pipelinewhere) | | (Public Preview) Filters the documents from previous stages to only include those matching the specified [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class).

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class), typically including but not limited to:

  • field comparators: , (less than), [Expression.greaterThan()](./firestore_pipelines.expression.md#expressiongreaterthan), etc.
  • logical operators: , , , etc.
  • advanced functions: [Expression.regexMatch()](./firestore_pipelines.expression.md#expressionregexmatch), [Expression.arrayContains()](./firestore_pipelines.expression.md#expressionarraycontains), etc.

Example: | -``` - | -| [offset(offset)](./firestore_lite_pipelines.pipeline.md#pipelineoffset) | | (Public Preview) Skips the first offset number of documents from the results of previous stages.

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve results in chunks. It is typically used in conjunction with to control the size of each page.

Example: -```typescript -// Retrieve the second page of 20 results -firestore.pipeline().collection('books') - .sort(field('published').descending()) - .offset(20) // Skip the first 20 results - .limit(20); // Take the next 20 results - -``` - | -| [offset(options)](./firestore_lite_pipelines.pipeline.md#pipelineoffset) | | (Public Preview) Skips the first offset number of documents from the results of previous stages.

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve results in chunks. It is typically used in conjunction with to control the size of each page.

Example: -```typescript -// Retrieve the second page of 20 results -firestore.pipeline().collection('books') - .sort(field('published').descending()) - .offset(20) // Skip the first 20 results - .limit(20); // Take the next 20 results - -``` - | -| [rawStage(name, params, options)](./firestore_lite_pipelines.pipeline.md#pipelinerawstage) | | (Public Preview) Adds a raw stage to the pipeline.

This method provides a flexible way to extend the pipeline's functionality by adding custom stages. Each raw stage is defined by a unique name and a set of params that control its behavior.

Example (Assuming there is no 'where' stage available in SDK): -```typescript -// Assume we don't have a built-in 'where' stage -firestore.pipeline().collection('books') - .rawStage('where', [field('published').lt(1900)]) // Custom 'where' stage - .select('title', 'author'); - -``` - | -| [removeFields(fieldValue, additionalFields)](./firestore_lite_pipelines.pipeline.md#pipelineremovefields) | | (Public Preview) Remove fields from outputs of previous stages.Example: -```typescript -firestore.pipeline().collection('books') - // removes field 'rating' and 'cost' from the previous stage outputs. - .removeFields( - field('rating'), - 'cost' - ); - -``` - | -| [removeFields(options)](./firestore_lite_pipelines.pipeline.md#pipelineremovefields) | | (Public Preview) Remove fields from outputs of previous stages.Example: -```typescript -firestore.pipeline().collection('books') - // removes field 'rating' and 'cost' from the previous stage outputs. - .removeFields( - field('rating'), - 'cost' - ); - -``` - | -| [replaceWith(fieldName)](./firestore_lite_pipelines.pipeline.md#pipelinereplacewith) | | (Public Preview) Fully overwrites all fields in a document with those coming from a nested map.

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value.

Example: -```typescript -// Input. -// { -// 'name': 'John Doe Jr.', -// 'parents': { -// 'father': 'John Doe Sr.', -// 'mother': 'Jane Doe' -// } -// } - -// Emit parents as document. -firestore.pipeline().collection('people').replaceWith('parents'); - -// Output -// { -// 'father': 'John Doe Sr.', -// 'mother': 'Jane Doe' -// } - -``` - | -| [replaceWith(expr)](./firestore_lite_pipelines.pipeline.md#pipelinereplacewith) | | (Public Preview) Fully overwrites all fields in a document with those coming from a map.

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value.

Example: -```typescript -// Input. -// { -// 'name': 'John Doe Jr.', -// 'parents': { -// 'father': 'John Doe Sr.', -// 'mother': 'Jane Doe' -// } -// } - -// Emit parents as document. -firestore.pipeline().collection('people').replaceWith(map({ - foo: 'bar', - info: { - name: field('name') - } -})); - -// Output -// { -// 'father': 'John Doe Sr.', -// 'mother': 'Jane Doe' -// } - -``` - | -| [replaceWith(options)](./firestore_lite_pipelines.pipeline.md#pipelinereplacewith) | | (Public Preview) Fully overwrites all fields in a document with those coming from a map.

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value.

Example: -```typescript -// Input. -// { -// 'name': 'John Doe Jr.', -// 'parents': { -// 'father': 'John Doe Sr.', -// 'mother': 'Jane Doe' -// } -// } +## Pipeline.addFields() -// Emit parents as document. -firestore.pipeline().collection('people').replaceWith(map({ - foo: 'bar', - info: { - name: field('name') - } -})); +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -// Output -// { -// 'father': 'John Doe Sr.', -// 'mother': 'Jane Doe' -// } +Adds new fields to outputs from previous stages. -``` - | -| [sample(documents)](./firestore_lite_pipelines.pipeline.md#pipelinesample) | | (Public Preview) Performs a pseudo-random sampling of the documents from the previous stage.

This stage will filter documents pseudo-randomly. The parameter specifies how number of documents to be returned.

Examples: -```typescript -// Sample 25 books, if available. -firestore.pipeline().collection('books') - .sample(25); +This stage allows you to compute values on-the-fly based on existing data from previous stages or constants. You can use this to create new fields or overwrite existing ones (if there is name overlaps). -``` - | -| [sample(options)](./firestore_lite_pipelines.pipeline.md#pipelinesample) | | (Public Preview) Performs a pseudo-random sampling of the documents from the previous stage.

This stage will filter documents pseudo-randomly. The 'options' parameter specifies how sampling will be performed. See for more information.

Examples:// Sample 10 books, if available. firestore.pipeline().collection("books") .sample({ documents: 10 });// Sample 50% of books. firestore.pipeline().collection("books") .sample({ percentage: 0.5 }); | -| [select(selection, additionalSelections)](./firestore_lite_pipelines.pipeline.md#pipelineselect) | | (Public Preview) Selects or creates a set of fields from the outputs of previous stages.

The selected fields are defined using expressions, which can be:

  • : Name of an existing field
  • : References an existing field.
  • : Represents the result of a function with an assigned alias name using

If no selections are provided, the output of this stage is empty. Use instead if only additions are desired.

Example: -```typescript -db.pipeline().collection("books") - .select( - "firstName", - field("lastName"), - field("address").toUppercase().as("upperAddress"), - ); +The added fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface)s, which can be: -``` - | -| [select(options)](./firestore_lite_pipelines.pipeline.md#pipelineselect) | | (Public Preview) Selects or creates a set of fields from the outputs of previous stages.

The selected fields are defined using expressions, which can be:

  • : Name of an existing field
  • : References an existing field.
  • : Represents the result of a function with an assigned alias name using

If no selections are provided, the output of this stage is empty. Use instead if only additions are desired.

Example: -```typescript -db.pipeline().collection("books") - .select( - "firstName", - field("lastName"), - field("address").toUppercase().as("upperAddress"), - ); +- [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [Expression](./firestore_pipelines.expression.md#expression_class): Either a literal value (see [constant()](./firestore_pipelines.md#constant_0c00f91)) or a computed value with an assigned alias using [Expression.as()](./firestore_pipelines.expression.md#expressionas). -``` - | -| [sort(ordering, additionalOrderings)](./firestore_lite_pipelines.pipeline.md#pipelinesort) | | (Public Preview) Sorts the documents from previous stages based on one or more criteria.

This stage allows you to order the results of your pipeline. You can specify multiple instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified.

Example: -```typescript -// Sort books by rating in descending order, and then by title in ascending order for books -// with the same rating -firestore.pipeline().collection("books") - .sort( - Ordering.of(field("rating")).descending(), - Ordering.of(field("title")) // Ascending order is the default - ); +Example: -``` - | -| [sort(options)](./firestore_lite_pipelines.pipeline.md#pipelinesort) | | (Public Preview) Sorts the documents from previous stages based on one or more criteria.

This stage allows you to order the results of your pipeline. You can specify multiple instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified.

Example: -```typescript -// Sort books by rating in descending order, and then by title in ascending order for books -// with the same rating -firestore.pipeline().collection("books") - .sort( - Ordering.of(field("rating")).descending(), - Ordering.of(field("title")) // Ascending order is the default - ); +Signature: -``` - | -| [union(other)](./firestore_lite_pipelines.pipeline.md#pipelineunion) | | (Public Preview) Performs union of all documents from two pipelines, including duplicates.

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the other given in parameter. The order of documents emitted from this stage is undefined.

Example: ```typescript -// Emit documents from books collection and magazines collection. -firestore.pipeline().collection('books') - .union(firestore.pipeline().collection('magazines')); - +addFields(field: Selectable, ...additionalFields: Selectable[]): Pipeline; ``` - | -| [union(options)](./firestore_lite_pipelines.pipeline.md#pipelineunion) | | (Public Preview) Performs union of all documents from two pipelines, including duplicates.

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the other given in parameter. The order of documents emitted from this stage is undefined.

Example: -```typescript -// Emit documents from books collection and magazines collection. -firestore.pipeline().collection('books') - .union(firestore.pipeline().collection('magazines')); -``` - | -| [unnest(selectable, indexField)](./firestore_lite_pipelines.pipeline.md#pipelineunnest) | | (Public Preview) Produces a document for each element in an input array.For each previous stage document, this stage will emit zero or more augmented documents. The input array specified by the selectable parameter, will emit an augmented document for each input array element. The input array element will augment the previous stage document by setting the alias field with the array element value.When selectable evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for the current input document, returning it as is with the alias field absent.No documents are emitted when selectable evaluates to an empty array.Example: -```typescript -// Input: -// { "title": "The Hitchhiker's Guide to the Galaxy", "tags": [ "comedy", "space", "adventure" ], ... } +#### Parameters -// Emit a book document for each tag of the book. -firestore.pipeline().collection("books") - .unnest(field("tags").as('tag'), 'tagIndex'); +| Parameter | Type | Description | +| --- | --- | --- | +| field | [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface) | The first field to add to the documents, specified as a [Selectable](./firestore_pipelines.selectable.md#selectable_interface). | +| additionalFields | [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface)\[\] | Optional additional fields to add to the documents, specified as [Selectable](./firestore_pipelines.selectable.md#selectable_interface)s. | -// Output: -// { "title": "The Hitchhiker's Guide to the Galaxy", "tag": "comedy", "tagIndex": 0, ... } -// { "title": "The Hitchhiker's Guide to the Galaxy", "tag": "space", "tagIndex": 1, ... } -// { "title": "The Hitchhiker's Guide to the Galaxy", "tag": "adventure", "tagIndex": 2, ... } +Returns: -``` - | -| [unnest(options)](./firestore_lite_pipelines.pipeline.md#pipelineunnest) | | (Public Preview) Produces a document for each element in an input array.For each previous stage document, this stage will emit zero or more augmented documents. The input array specified by the selectable parameter, will emit an augmented document for each input array element. The input array element will augment the previous stage document by setting the alias field with the array element value.When selectable evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for the current input document, returning it as is with the alias field absent.No documents are emitted when selectable evaluates to an empty array.Example: -```typescript -// Input: -// { "title": "The Hitchhiker's Guide to the Galaxy", "tags": [ "comedy", "space", "adventure" ], ... } +[Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -// Emit a book document for each tag of the book. -firestore.pipeline().collection("books") - .unnest(field("tags").as('tag'), 'tagIndex'); +A new Pipeline object with this stage appended to the stage list. -// Output: -// { "title": "The Hitchhiker's Guide to the Galaxy", "tag": "comedy", "tagIndex": 0, ... } -// { "title": "The Hitchhiker's Guide to the Galaxy", "tag": "space", "tagIndex": 1, ... } -// { "title": "The Hitchhiker's Guide to the Galaxy", "tag": "adventure", "tagIndex": 2, ... } +### Example -``` - | -| [where(condition)](./firestore_lite_pipelines.pipeline.md#pipelinewhere) | | (Public Preview) Filters the documents from previous stages to only include those matching the specified .

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of , typically including but not limited to:

  • field comparators: , (less than), (greater than), etc.
  • logical operators: , , , etc.
  • advanced functions: , , etc.

Example: -```typescript -firestore.pipeline().collection("books") - .where( - and( - gt(field("rating"), 4.0), // Filter for ratings greater than 4.0 - field("genre").eq("Science Fiction") // Equivalent to gt("genre", "Science Fiction") - ) - ); -``` - | -| [where(options)](./firestore_lite_pipelines.pipeline.md#pipelinewhere) | | (Public Preview) Filters the documents from previous stages to only include those matching the specified .

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of , typically including but not limited to:

  • field comparators: , (less than), (greater than), etc.
  • logical operators: , , , etc.
  • advanced functions: , , etc.

Example: ```typescript firestore.pipeline().collection("books") - .where( - and( - gt(field("rating"), 4.0), // Filter for ratings greater than 4.0 - field("genre").eq("Science Fiction") // Equivalent to gt("genre", "Science Fiction") - ) + .addFields( + field("rating").as("bookRating"), // Rename 'rating' to 'bookRating' + add(5, field("quantity")).as("totalCost") // Calculate 'totalCost' ); ``` - | ## Pipeline.addFields() @@ -413,52 +134,32 @@ Adds new fields to outputs from previous stages. This stage allows you to compute values on-the-fly based on existing data from previous stages or constants. You can use this to create new fields or overwrite existing ones (if there is name overlaps). -The added fields are defined using s, which can be: +The added fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface)s, which can be: -- : References an existing document field. - : Either a literal value (see ) or a computed value (see ) with an assigned alias using . +- [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [Expression](./firestore_pipelines.expression.md#expression_class): Either a literal value (see [constant()](./firestore_pipelines.md#constant_0c00f91)) or a computed value with an assigned alias using [Expression.as()](./firestore_pipelines.expression.md#expressionas). Example: -```typescript -firestore.pipeline().collection("books") - .addFields( - field("rating").as("bookRating"), // Rename 'rating' to 'bookRating' - add(5, field("quantity")).as("totalCost") // Calculate 'totalCost' - ); - -``` - Signature: ```typescript -addFields(field: Selectable, ...additionalFields: Selectable[]): Pipeline; +addFields(options: AddFieldsStageOptions): Pipeline; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| field | [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface) | The first field to add to the documents, specified as a . | -| additionalFields | [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface)\[\] | Optional additional fields to add to the documents, specified as s. A new Pipeline object with this stage appended to the stage list. | +| options | [AddFieldsStageOptions](./firestore_lite_pipelines.md#addfieldsstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.addFields() +A new Pipeline object with this stage appended to the stage list. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Adds new fields to outputs from previous stages. - -This stage allows you to compute values on-the-fly based on existing data from previous stages or constants. You can use this to create new fields or overwrite existing ones (if there is name overlaps). - -The added fields are defined using s, which can be: - -- : References an existing document field. - : Either a literal value (see ) or a computed value (see ) with an assigned alias using . - -Example: ```typescript firestore.pipeline().collection("books") @@ -469,32 +170,38 @@ firestore.pipeline().collection("books") ``` +## Pipeline.aggregate() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Performs aggregation operations on the documents from previous stages. + +

This stage allows you to calculate aggregate values over a set of documents. You define the aggregations to perform using [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) expressions which are typically results of calling [Expression.as()](./firestore_pipelines.expression.md#expressionas) on [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) instances. + +

Example: + Signature: ```typescript -addFields(options: AddFieldsStageOptions): Pipeline; +aggregate(accumulator: AliasedAggregate, ...additionalAccumulators: AliasedAggregate[]): Pipeline; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| options | [AddFieldsStageOptions](./firestore_lite_pipelines.md#addfieldsstageoptions) | An object that specifies required and optional parameters for the stage. A new Pipeline object with this stage appended to the stage list. | +| accumulator | [AliasedAggregate](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregate_class) | The first [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class), wrapping an [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) and providing a name for the accumulated results. | +| additionalAccumulators | [AliasedAggregate](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregate_class)\[\] | Optional additional [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class), each wrapping an [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) and providing a name for the accumulated results. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.aggregate() +A new Pipeline object with this stage appended to the stage list. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Performs aggregation operations on the documents from previous stages. - -

This stage allows you to calculate aggregate values over a set of documents. You define the aggregations to perform using expressions which are typically results of calling on instances. - -

Example: ```typescript // Calculate the average rating and the total number of books @@ -506,23 +213,6 @@ firestore.pipeline().collection("books") ``` -Signature: - -```typescript -aggregate(accumulator: AliasedAggregate, ...additionalAccumulators: AliasedAggregate[]): Pipeline; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| accumulator | [AliasedAggregate](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregate_class) | The first , wrapping an and providing a name for the accumulated results. | -| additionalAccumulators | [AliasedAggregate](./firestore_lite_pipelines.aliasedaggregate.md#aliasedaggregate_class)\[\] | Optional additional , each wrapping an and providing a name for the accumulated results. A new Pipeline object with this stage appended to the stage list. | - -Returns: - -[Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) - ## Pipeline.aggregate() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -532,20 +222,10 @@ Performs optionally grouped aggregation operations on the documents from previou

This stage allows you to calculate aggregate values over a set of documents, optionally grouped by one or more fields or functions. You can specify: -

  • \*\*Grouping Fields or Functions:\*\* One or more fields or functions to group the documents by. For each distinct combination of values in these fields, a separate group is created. If no grouping fields are provided, a single group containing all documents is used. Not specifying groups is the same as putting the entire inputs into one group.
  • \*\*Accumulators:\*\* One or more accumulation operations to perform within each group. These are defined using expressions, which are typically created by calling on instances. Each aggregation calculates a value (e.g., sum, average, count) based on the documents within its group.
+
  • \*\*Grouping Fields or Functions:\*\* One or more fields or functions to group the documents by. For each distinct combination of values in these fields, a separate group is created. If no grouping fields are provided, a single group containing all documents is used. Not specifying groups is the same as putting the entire inputs into one group.
  • \*\*Accumulators:\*\* One or more accumulation operations to perform within each group. These are defined using [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) expressions, which are typically created by calling [Expression.as()](./firestore_pipelines.expression.md#expressionas) on [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) instances. Each aggregation calculates a value (e.g., sum, average, count) based on the documents within its group.

Example: -```typescript -// Calculate the average rating for each genre. -firestore.pipeline().collection("books") - .aggregate({ - accumulators: [avg(field("rating")).as("avg_rating")] - groups: ["genre"] - }); - -``` - Signature: ```typescript @@ -556,12 +236,27 @@ aggregate(options: AggregateStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [AggregateStageOptions](./firestore_lite_pipelines.md#aggregatestageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | +| options | [AggregateStageOptions](./firestore_lite_pipelines.md#aggregatestageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Calculate the average rating for each genre. +firestore.pipeline().collection("books") + .aggregate({ + accumulators: [avg(field("rating")).as("avg_rating")] + groups: ["genre"] + }); + +``` + ## Pipeline.distinct() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -569,21 +264,13 @@ aggregate(options: AggregateStageOptions): Pipeline; Returns a set of distinct values from the inputs to this stage. -This stage runs through the results from previous stages to include only results with unique combinations of values (, , etc). +This stage runs through the results from previous stages to include only results with unique combinations of [Expression](./firestore_pipelines.expression.md#expression_class) values ([Field](./firestore_pipelines.field.md#field_class), [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class), etc). -The parameters to this stage are defined using expressions or strings: - -- : Name of an existing field - : References an existing document field. - : Represents the result of a function with an assigned alias name using . - -Example: +The parameters to this stage are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions or strings: -```typescript -// Get a list of unique author names in uppercase and genre combinations. -firestore.pipeline().collection("books") - .distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt") - .select("authorName"); +- `string`: Name of an existing field - [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas). -``` +Example: Signature: @@ -595,13 +282,26 @@ distinct(group: string | Selectable, ...additionalGroups: Array> | Optional additional expressions to consider when determining distinct value combinations or strings representing field names. A new object with this stage appended to the stage list. | +| group | string \| [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface) | The [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expression or field name to consider when determining distinct value combinations. | +| additionalGroups | Array<string \| [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface)> | Optional additional [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions to consider when determining distinct value combinations or strings representing field names. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Get a list of unique author names in uppercase and genre combinations. +firestore.pipeline().collection("books") + .distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt") + .select("authorName"); + +``` + ## Pipeline.distinct() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -609,22 +309,14 @@ distinct(group: string | Selectable, ...additionalGroups: Array, , etc). +This stage runs through the results from previous stages to include only results with unique combinations of [Expression](./firestore_pipelines.expression.md#expression_class) values ([Field](./firestore_pipelines.field.md#field_class), [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class), etc). -The parameters to this stage are defined using expressions or strings: +The parameters to this stage are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions or strings: -- : Name of an existing field - : References an existing document field. - : Represents the result of a function with an assigned alias name using . +- `string`: Name of an existing field - [Field](./firestore_pipelines.field.md#field_class): References an existing document field. - [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas). Example: -```typescript -// Get a list of unique author names in uppercase and genre combinations. -firestore.pipeline().collection("books") - .distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt") - .select("authorName"); - -``` - Signature: ```typescript @@ -635,12 +327,25 @@ distinct(options: DistinctStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [DistinctStageOptions](./firestore_lite_pipelines.md#distinctstageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | +| options | [DistinctStageOptions](./firestore_lite_pipelines.md#distinctstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Get a list of unique author names in uppercase and genre combinations. +firestore.pipeline().collection("books") + .distinct(toUppercase(field("author")).as("authorName"), field("genre"), "publishedAt") + .select("authorName"); + +``` + ## Pipeline.findNearest() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -676,12 +381,14 @@ findNearest(options: FindNearestStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [FindNearestStageOptions](./firestore_lite_pipelines.md#findneareststageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | +| options | [FindNearestStageOptions](./firestore_lite_pipelines.md#findneareststageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + ## Pipeline.limit() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -695,14 +402,6 @@ Limits the maximum number of documents returned by previous stages to `limit`Example: -```typescript -// Limit the results to the top 10 highest-rated books -firestore.pipeline().collection('books') - .sort(field('rating').descending()) - .limit(10); - -``` - Signature: ```typescript @@ -713,12 +412,25 @@ limit(limit: number): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| limit | number | The maximum number of documents to return. A new Pipeline object with this stage appended to the stage list. | +| limit | number | The maximum number of documents to return. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new Pipeline object with this stage appended to the stage list. + +### Example + + +```typescript +// Limit the results to the top 10 highest-rated books +firestore.pipeline().collection('books') + .sort(field('rating').descending()) + .limit(10); + +``` + ## Pipeline.limit() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -732,14 +444,6 @@ Limits the maximum number of documents returned by previous stages to `limit`Example: -```typescript -// Limit the results to the top 10 highest-rated books -firestore.pipeline().collection('books') - .sort(field('rating').descending()) - .limit(10); - -``` - Signature: ```typescript @@ -750,12 +454,25 @@ limit(options: LimitStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [LimitStageOptions](./firestore_lite_pipelines.md#limitstageoptions) | An object that specifies required and optional parameters for the stage. A new Pipeline object with this stage appended to the stage list. | +| options | [LimitStageOptions](./firestore_lite_pipelines.md#limitstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new Pipeline object with this stage appended to the stage list. + +### Example + + +```typescript +// Limit the results to the top 10 highest-rated books +firestore.pipeline().collection('books') + .sort(field('rating').descending()) + .limit(10); + +``` + ## Pipeline.offset() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -767,15 +484,6 @@ Skips the first `offset` number of documents from the results of previous stages

Example: -```typescript -// Retrieve the second page of 20 results -firestore.pipeline().collection('books') - .sort(field('published').descending()) - .offset(20) // Skip the first 20 results - .limit(20); // Take the next 20 results - -``` - Signature: ```typescript @@ -786,22 +494,16 @@ offset(offset: number): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| offset | number | The number of documents to skip. A new Pipeline object with this stage appended to the stage list. | +| offset | number | The number of documents to skip. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.offset() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Skips the first `offset` number of documents from the results of previous stages. +A new Pipeline object with this stage appended to the stage list. -

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve results in chunks. It is typically used in conjunction with to control the size of each page. +### Example -

Example: ```typescript // Retrieve the second page of 20 results @@ -812,6 +514,17 @@ firestore.pipeline().collection('books') ``` +## Pipeline.offset() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Skips the first `offset` number of documents from the results of previous stages. + +

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve results in chunks. It is typically used in conjunction with to control the size of each page. + +

Example: + Signature: ```typescript @@ -822,12 +535,26 @@ offset(options: OffsetStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [OffsetStageOptions](./firestore_lite_pipelines.md#offsetstageoptions) | An object that specifies required and optional parameters for the stage. A new Pipeline object with this stage appended to the stage list. | +| options | [OffsetStageOptions](./firestore_lite_pipelines.md#offsetstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new Pipeline object with this stage appended to the stage list. + +### Example + + +```typescript +// Retrieve the second page of 20 results +firestore.pipeline().collection('books') + .sort(field('published').descending()) + .offset(20) // Skip the first 20 results + .limit(20); // Take the next 20 results + +``` + ## Pipeline.rawStage() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -839,14 +566,6 @@ Adds a raw stage to the pipeline.

Example (Assuming there is no 'where' stage available in SDK): -```typescript -// Assume we don't have a built-in 'where' stage -firestore.pipeline().collection('books') - .rawStage('where', [field('published').lt(1900)]) // Custom 'where' stage - .select('title', 'author'); - -``` - Signature: ```typescript @@ -861,12 +580,25 @@ rawStage(name: string, params: unknown[], options?: { | --- | --- | --- | | name | string | The unique name of the raw stage to add. | | params | unknown\[\] | A list of parameters to configure the raw stage's behavior. | -| options | { \[key: string\]: [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown; } | An object of key value pairs that specifies optional parameters for the stage. A new object with this stage appended to the stage list. | +| options | { \[key: string\]: [Expression](./firestore_lite_pipelines.expression.md#expression_class) \| unknown; } | An object of key value pairs that specifies optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Assume we don't have a built-in 'where' stage +firestore.pipeline().collection('books') + .rawStage('where', [field('published').lt(1900)]) // Custom 'where' stage + .select('title', 'author'); + +``` + ## Pipeline.removeFields() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -876,16 +608,6 @@ Remove fields from outputs of previous stages. Example: -```typescript -firestore.pipeline().collection('books') - // removes field 'rating' and 'cost' from the previous stage outputs. - .removeFields( - field('rating'), - 'cost' - ); - -``` - Signature: ```typescript @@ -897,20 +619,16 @@ removeFields(fieldValue: Field | string, ...additionalFields: ArrayReturns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.removeFields() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +A new Pipeline object with this stage appended to the stage list. -Remove fields from outputs of previous stages. +### Example -Example: ```typescript firestore.pipeline().collection('books') @@ -922,6 +640,15 @@ firestore.pipeline().collection('books') ``` +## Pipeline.removeFields() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Remove fields from outputs of previous stages. + +Example: + Signature: ```typescript @@ -932,12 +659,27 @@ removeFields(options: RemoveFieldsStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [RemoveFieldsStageOptions](./firestore_lite_pipelines.md#removefieldsstageoptions) | An object that specifies required and optional parameters for the stage. A new Pipeline object with this stage appended to the stage list. | +| options | [RemoveFieldsStageOptions](./firestore_lite_pipelines.md#removefieldsstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new Pipeline object with this stage appended to the stage list. + +### Example + + +```typescript +firestore.pipeline().collection('books') + // removes field 'rating' and 'cost' from the previous stage outputs. + .removeFields( + field('rating'), + 'cost' + ); + +``` + ## Pipeline.replaceWith() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -949,6 +691,27 @@ Fully overwrites all fields in a document with those coming from a nested map.

Example: +Signature: + +```typescript +replaceWith(fieldName: string): Pipeline; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | The [Field](./firestore_pipelines.field.md#field_class) field containing the nested map. | + +Returns: + +[Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) + +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + ```typescript // Input. // { @@ -970,32 +733,37 @@ firestore.pipeline().collection('people').replaceWith('parents'); ``` +## Pipeline.replaceWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Fully overwrites all fields in a document with those coming from a map. + +

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value. + +

Example: + Signature: ```typescript -replaceWith(fieldName: string): Pipeline; +replaceWith(expr: Expression): Pipeline; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field containing the nested map. A new object with this stage appended to the stage list. | +| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An [Expression](./firestore_pipelines.expression.md#expression_class) that when returned evaluates to a map. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.replaceWith() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Fully overwrites all fields in a document with those coming from a map. +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. -

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value. +### Example -

Example: ```typescript // Input. @@ -1023,32 +791,37 @@ firestore.pipeline().collection('people').replaceWith(map({ ``` +## Pipeline.replaceWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Fully overwrites all fields in a document with those coming from a map. + +

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value. + +

Example: + Signature: ```typescript -replaceWith(expr: Expression): Pipeline; +replaceWith(options: ReplaceWithStageOptions): Pipeline; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_lite_pipelines.expression.md#expression_class) | An that when returned evaluates to a map. A new object with this stage appended to the stage list. | +| options | [ReplaceWithStageOptions](./firestore_lite_pipelines.md#replacewithstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.replaceWith() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Fully overwrites all fields in a document with those coming from a map. +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. -

This stage allows you to emit a map value as a document. Each key of the map becomes a field on the document that contains the corresponding value. +### Example -

Example: ```typescript // Input. @@ -1076,22 +849,6 @@ firestore.pipeline().collection('people').replaceWith(map({ ``` -Signature: - -```typescript -replaceWith(options: ReplaceWithStageOptions): Pipeline; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| options | [ReplaceWithStageOptions](./firestore_lite_pipelines.md#replacewithstageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | - -Returns: - -[Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) - ## Pipeline.sample() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1099,16 +856,9 @@ replaceWith(options: ReplaceWithStageOptions): Pipeline; Performs a pseudo-random sampling of the documents from the previous stage. -

This stage will filter documents pseudo-randomly. The parameter specifies how number of documents to be returned. - -

Examples: - -```typescript -// Sample 25 books, if available. -firestore.pipeline().collection('books') - .sample(25); +

This stage will filter documents pseudo-randomly. The parameter specifies how number of documents to be returned. -``` +

Examples: Signature: @@ -1120,12 +870,24 @@ sample(documents: number): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| documents | number | The number of documents to sample. A new object with this stage appended to the stage list. | +| documents | number | The number of documents to sample. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Sample 25 books, if available. +firestore.pipeline().collection('books') + .sample(25); + +``` + ## Pipeline.sample() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1133,13 +895,7 @@ sample(documents: number): Pipeline; Performs a pseudo-random sampling of the documents from the previous stage. -

This stage will filter documents pseudo-randomly. The 'options' parameter specifies how sampling will be performed. See for more information. - -

Examples: - -// Sample 10 books, if available. firestore.pipeline().collection("books") .sample({ documents: 10 }); - -// Sample 50% of books. firestore.pipeline().collection("books") .sample({ percentage: 0.5 }); +

This stage will filter documents pseudo-randomly. The 'options' parameter specifies how sampling will be performed. See [SampleStageOptions](./firestore_pipelines.md#samplestageoptions) for more information. Signature: @@ -1151,12 +907,28 @@ sample(options: SampleStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [SampleStageOptions](./firestore_lite_pipelines.md#samplestageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | +| options | [SampleStageOptions](./firestore_lite_pipelines.md#samplestageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Sample 10 books, if available. +firestore.pipeline().collection("books") + .sample({ documents: 10 }); + +// Sample 50% of books. +firestore.pipeline().collection("books") + .sample({ percentage: 0.5 }); + +``` + ## Pipeline.select() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1164,24 +936,14 @@ sample(options: SampleStageOptions): Pipeline; Selects or creates a set of fields from the outputs of previous stages. -

The selected fields are defined using expressions, which can be: +

The selected fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions, which can be: -

  • : Name of an existing field
  • : References an existing field.
  • : Represents the result of a function with an assigned alias name using
+
  • `string` : Name of an existing field
  • [Field](./firestore_pipelines.field.md#field_class): References an existing field.
  • [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas)
-

If no selections are provided, the output of this stage is empty. Use instead if only additions are desired. +

If no selections are provided, the output of this stage is empty. Use [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields) instead if only additions are desired.

Example: -```typescript -db.pipeline().collection("books") - .select( - "firstName", - field("lastName"), - field("address").toUppercase().as("upperAddress"), - ); - -``` - Signature: ```typescript @@ -1192,27 +954,17 @@ select(selection: Selectable | string, ...additionalSelections: Arraystring values representing field names. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.select() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Selects or creates a set of fields from the outputs of previous stages. - -

The selected fields are defined using expressions, which can be: +A new Pipeline object with this stage appended to the stage list. -

  • : Name of an existing field
  • : References an existing field.
  • : Represents the result of a function with an assigned alias name using
+### Example -

If no selections are provided, the output of this stage is empty. Use instead if only additions are desired. - -

Example: ```typescript db.pipeline().collection("books") @@ -1224,6 +976,21 @@ db.pipeline().collection("books") ``` +## Pipeline.select() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Selects or creates a set of fields from the outputs of previous stages. + +

The selected fields are defined using [Selectable](./firestore_pipelines.selectable.md#selectable_interface) expressions, which can be: + +

  • `string`: Name of an existing field
  • [Field](./firestore_pipelines.field.md#field_class): References an existing field.
  • [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class): Represents the result of a function with an assigned alias name using [Expression.as()](./firestore_pipelines.expression.md#expressionas)
+ +

If no selections are provided, the output of this stage is empty. Use [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields) instead if only additions are desired. + +

Example: + Signature: ```typescript @@ -1234,34 +1001,38 @@ select(options: SelectStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [SelectStageOptions](./firestore_lite_pipelines.md#selectstageoptions) | An object that specifies required and optional parameters for the stage. A new Pipeline object with this stage appended to the stage list. | +| options | [SelectStageOptions](./firestore_lite_pipelines.md#selectstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new Pipeline object with this stage appended to the stage list. + +### Example + + +```typescript +db.pipeline().collection("books") + .select( + "firstName", + field("lastName"), + field("address").toUppercase().as("upperAddress"), + ); + +``` + ## Pipeline.sort() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Sorts the documents from previous stages based on one or more criteria. +Sorts the documents from previous stages based on one or more [Ordering](./firestore_pipelines.ordering.md#ordering_class) criteria. -

This stage allows you to order the results of your pipeline. You can specify multiple instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified. +

This stage allows you to order the results of your pipeline. You can specify multiple [Ordering](./firestore_pipelines.ordering.md#ordering_class) instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified.

Example: -```typescript -// Sort books by rating in descending order, and then by title in ascending order for books -// with the same rating -firestore.pipeline().collection("books") - .sort( - Ordering.of(field("rating")).descending(), - Ordering.of(field("title")) // Ascending order is the default - ); - -``` - Signature: ```typescript @@ -1272,23 +1043,17 @@ sort(ordering: Ordering, ...additionalOrderings: Ordering[]): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| ordering | [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) | The first instance specifying the sorting criteria. | -| additionalOrderings | [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class)\[\] | Optional additional instances specifying the additional sorting criteria. A new object with this stage appended to the stage list. | +| ordering | [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class) | The first [Ordering](./firestore_pipelines.ordering.md#ordering_class) instance specifying the sorting criteria. | +| additionalOrderings | [Ordering](./firestore_lite_pipelines.ordering.md#ordering_class)\[\] | Optional additional [Ordering](./firestore_pipelines.ordering.md#ordering_class) instances specifying the additional sorting criteria. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.sort() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. -Sorts the documents from previous stages based on one or more criteria. +### Example -

This stage allows you to order the results of your pipeline. You can specify multiple instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified. - -

Example: ```typescript // Sort books by rating in descending order, and then by title in ascending order for books @@ -1301,6 +1066,17 @@ firestore.pipeline().collection("books") ``` +## Pipeline.sort() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Sorts the documents from previous stages based on one or more [Ordering](./firestore_pipelines.ordering.md#ordering_class) criteria. + +

This stage allows you to order the results of your pipeline. You can specify multiple [Ordering](./firestore_pipelines.ordering.md#ordering_class) instances to sort by multiple fields in ascending or descending order. If documents have the same value for a field used for sorting, the next specified ordering will be used. If all orderings result in equal comparison, the documents are considered equal and the order is unspecified. + +

Example: + Signature: ```typescript @@ -1311,12 +1087,28 @@ sort(options: SortStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [SortStageOptions](./firestore_lite_pipelines.md#sortstageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | +| options | [SortStageOptions](./firestore_lite_pipelines.md#sortstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Sort books by rating in descending order, and then by title in ascending order for books +// with the same rating +firestore.pipeline().collection("books") + .sort( + Ordering.of(field("rating")).descending(), + Ordering.of(field("title")) // Ascending order is the default + ); + +``` + ## Pipeline.union() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1324,17 +1116,10 @@ sort(options: SortStageOptions): Pipeline; Performs union of all documents from two pipelines, including duplicates. -

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the `other` given in parameter. The order of documents emitted from this stage is undefined. +

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the `other` [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) given in parameter. The order of documents emitted from this stage is undefined.

Example: -```typescript -// Emit documents from books collection and magazines collection. -firestore.pipeline().collection('books') - .union(firestore.pipeline().collection('magazines')); - -``` - Signature: ```typescript @@ -1345,22 +1130,16 @@ union(other: Pipeline): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| other | [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) | The other that is part of union. A new object with this stage appended to the stage list. | +| other | [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) | The other [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) that is part of union. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.union() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Performs union of all documents from two pipelines, including duplicates. +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. -

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the `other` given in parameter. The order of documents emitted from this stage is undefined. +### Example -

Example: ```typescript // Emit documents from books collection and magazines collection. @@ -1369,6 +1148,17 @@ firestore.pipeline().collection('books') ``` +## Pipeline.union() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Performs union of all documents from two pipelines, including duplicates. + +

This stage will pass through documents from previous stage, and also pass through documents from previous stage of the `other` [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) given in parameter. The order of documents emitted from this stage is undefined. + +

Example: + Signature: ```typescript @@ -1379,12 +1169,24 @@ union(options: UnionStageOptions): Pipeline; | Parameter | Type | Description | | --- | --- | --- | -| options | [UnionStageOptions](./firestore_lite_pipelines.md#unionstageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | +| options | [UnionStageOptions](./firestore_lite_pipelines.md#unionstageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + +```typescript +// Emit documents from books collection and magazines collection. +firestore.pipeline().collection('books') + .union(firestore.pipeline().collection('magazines')); + +``` + ## Pipeline.unnest() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1400,6 +1202,28 @@ No documents are emitted when `selectable` evaluates to an empty array. Example: +Signature: + +```typescript +unnest(selectable: Selectable, indexField?: string): Pipeline; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| selectable | [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface) | A selectable expression defining the field to unnest and the alias to use for each un-nested element in the output documents. | +| indexField | string | An optional string value specifying the field path to write the offset (starting at zero) into the array the un-nested element is from | + +Returns: + +[Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) + +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. + +### Example + + ```typescript // Input: // { "title": "The Hitchhiker's Guide to the Galaxy", "tags": [ "comedy", "space", "adventure" ], ... } @@ -1415,37 +1239,41 @@ firestore.pipeline().collection("books") ``` +## Pipeline.unnest() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Produces a document for each element in an input array. + +For each previous stage document, this stage will emit zero or more augmented documents. The input array specified by the `selectable` parameter, will emit an augmented document for each input array element. The input array element will augment the previous stage document by setting the `alias` field with the array element value. + +When `selectable` evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for the current input document, returning it as is with the `alias` field absent. + +No documents are emitted when `selectable` evaluates to an empty array. + +Example: + Signature: ```typescript -unnest(selectable: Selectable, indexField?: string): Pipeline; +unnest(options: UnnestStageOptions): Pipeline; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| selectable | [Selectable](./firestore_lite_pipelines.selectable.md#selectable_interface) | A selectable expression defining the field to unnest and the alias to use for each un-nested element in the output documents. | -| indexField | string | An optional string value specifying the field path to write the offset (starting at zero) into the array the un-nested element is from A new object with this stage appended to the stage list. | +| options | [UnnestStageOptions](./firestore_lite_pipelines.md#unneststageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.unnest() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Produces a document for each element in an input array. - -For each previous stage document, this stage will emit zero or more augmented documents. The input array specified by the `selectable` parameter, will emit an augmented document for each input array element. The input array element will augment the previous stage document by setting the `alias` field with the array element value. - -When `selectable` evaluates to a non-array value (ex: number, null, absent), then the stage becomes a no-op for the current input document, returning it as is with the `alias` field absent. +A new [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) object with this stage appended to the stage list. -No documents are emitted when `selectable` evaluates to an empty array. +### Example -Example: ```typescript // Input: @@ -1462,34 +1290,39 @@ firestore.pipeline().collection("books") ``` +## Pipeline.where() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Filters the documents from previous stages to only include those matching the specified [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class). + +

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class), typically including but not limited to: + +

  • field comparators: [Expression.equal()](./firestore_pipelines.expression.md#expressionequal), [Expression.lessThan()](./firestore_pipelines.expression.md#expressionlessthan), [Expression.greaterThan()](./firestore_pipelines.expression.md#expressiongreaterthan), etc.
  • logical operators: , , , etc.
  • advanced functions: [Expression.regexMatch()](./firestore_pipelines.expression.md#expressionregexmatch), [Expression.arrayContains()](./firestore_pipelines.expression.md#expressionarraycontains), etc.
+ +

Example: + Signature: ```typescript -unnest(options: UnnestStageOptions): Pipeline; +where(condition: BooleanExpression): Pipeline; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| options | [UnnestStageOptions](./firestore_lite_pipelines.md#unneststageoptions) | An object that specifies required and optional parameters for the stage. A new object with this stage appended to the stage list. | +| condition | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) to apply. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.where() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Filters the documents from previous stages to only include those matching the specified . - -

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of , typically including but not limited to: +A new Pipeline object with this stage appended to the stage list. -

  • field comparators: , (less than), (greater than), etc.
  • logical operators: , , , etc.
  • advanced functions: , , etc.
+### Example -

Example: ```typescript firestore.pipeline().collection("books") @@ -1502,34 +1335,39 @@ firestore.pipeline().collection("books") ``` +## Pipeline.where() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Filters the documents from previous stages to only include those matching the specified [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class). + +

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class), typically including but not limited to: + +

  • field comparators: , (less than), [Expression.greaterThan()](./firestore_pipelines.expression.md#expressiongreaterthan), etc.
  • logical operators: , , , etc.
  • advanced functions: [Expression.regexMatch()](./firestore_pipelines.expression.md#expressionregexmatch), [Expression.arrayContains()](./firestore_pipelines.expression.md#expressionarraycontains), etc.
+ +

Example: + Signature: ```typescript -where(condition: BooleanExpression): Pipeline; +where(options: WhereStageOptions): Pipeline; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| condition | [BooleanExpression](./firestore_lite_pipelines.booleanexpression.md#booleanexpression_class) | The to apply. A new Pipeline object with this stage appended to the stage list. | +| options | [WhereStageOptions](./firestore_lite_pipelines.md#wherestageoptions) | An object that specifies required and optional parameters for the stage. | Returns: [Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) -## Pipeline.where() - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Filters the documents from previous stages to only include those matching the specified . +A new Pipeline object with this stage appended to the stage list. -

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. You can filter documents based on their field values, using implementations of , typically including but not limited to: +### Example -

  • field comparators: , (less than), (greater than), etc.
  • logical operators: , , , etc.
  • advanced functions: , , etc.
- -

Example: ```typescript firestore.pipeline().collection("books") @@ -1542,19 +1380,27 @@ firestore.pipeline().collection("books") ``` -Signature: +### Example + ```typescript -where(options: WhereStageOptions): Pipeline; -``` +const db: Firestore; // Assumes a valid firestore instance. -#### Parameters +// Example 1: Select specific fields and rename 'rating' to 'bookRating' +const results1 = await execute(db.pipeline() + .collection("books") + .select("title", "author", field("rating").as("bookRating"))); -| Parameter | Type | Description | -| --- | --- | --- | -| options | [WhereStageOptions](./firestore_lite_pipelines.md#wherestageoptions) | An object that specifies required and optional parameters for the stage. A new Pipeline object with this stage appended to the stage list. | +// Example 2: Filter documents where 'genre' is "Science Fiction" and 'published' is after 1950 +const results2 = await execute(db.pipeline() + .collection("books") + .where(and(field("genre").eq("Science Fiction"), field("published").gt(1950)))); -Returns: +// Example 3: Calculate the average rating of books published after 1980 +const results3 = await execute(db.pipeline() + .collection("books") + .where(field("published").gt(1980)) + .aggregate(avg(field("rating")).as("averageRating"))); -[Pipeline](./firestore_lite_pipelines.pipeline.md#pipeline_class) +``` diff --git a/docs-devsite/firestore_lite_pipelines.pipelineresult.md b/docs-devsite/firestore_lite_pipelines.pipelineresult.md index a2ac28a984..7dde1ef068 100644 --- a/docs-devsite/firestore_lite_pipelines.pipelineresult.md +++ b/docs-devsite/firestore_lite_pipelines.pipelineresult.md @@ -13,7 +13,7 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the or methods. +A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the [PipelineResult.data()](./firestore_pipelines.pipelineresult.md#pipelineresultdata) or [PipelineResult.get()](./firestore_pipelines.pipelineresult.md#pipelineresultget) methods.

If the PipelineResult represents a non-document result, `ref` will return a undefined value. @@ -27,10 +27,10 @@ export declare class PipelineResult | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [createTime](./firestore_lite_pipelines.pipelineresult.md#pipelineresultcreatetime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was created. Undefined if this result is not a document. {Timestamp\|undefined} | -| [id](./firestore_lite_pipelines.pipelineresult.md#pipelineresultid) | | string \| undefined | (Public Preview) The ID of the document for which this PipelineResult contains data, if it is a document; otherwise undefined. {string} | +| [createTime](./firestore_lite_pipelines.pipelineresult.md#pipelineresultcreatetime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was created. Undefined if this result is not a document. | +| [id](./firestore_lite_pipelines.pipelineresult.md#pipelineresultid) | | string \| undefined | (Public Preview) The ID of the document for which this PipelineResult contains data, if it is a document; otherwise undefined. | | [ref](./firestore_lite_pipelines.pipelineresult.md#pipelineresultref) | | [DocumentReference](./firestore_lite.documentreference.md#documentreference_class) \| undefined | (Public Preview) The reference of the document, if it is a document; otherwise undefined. | -| [updateTime](./firestore_lite_pipelines.pipelineresult.md#pipelineresultupdatetime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. {Timestamp\|undefined} | +| [updateTime](./firestore_lite_pipelines.pipelineresult.md#pipelineresultupdatetime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. | ## Methods @@ -46,8 +46,6 @@ export declare class PipelineResult The time the document was created. Undefined if this result is not a document. - {Timestamp\|undefined} - Signature: ```typescript @@ -61,8 +59,6 @@ get createTime(): Timestamp | undefined; The ID of the document for which this PipelineResult contains data, if it is a document; otherwise `undefined`. - {string} - Signature: ```typescript @@ -89,8 +85,6 @@ get ref(): DocumentReference | undefined; The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. - {Timestamp\|undefined} - Signature: ```typescript @@ -113,7 +107,7 @@ data(): AppModelType; AppModelType -{T} An object containing all fields in the document or 'undefined' if the document doesn't exist. +An object containing all fields in the document or 'undefined' if the document doesn't exist. ### Example @@ -151,7 +145,7 @@ get(fieldPath: string | FieldPath | Field): any; any -{\*} The data at the specified field location or undefined if no such field exists. +The data at the specified field location or `undefined` if no such field exists. ### Example diff --git a/docs-devsite/firestore_lite_pipelines.pipelinesnapshot.md b/docs-devsite/firestore_lite_pipelines.pipelinesnapshot.md index e5370fc1d0..d8e2f8f5bf 100644 --- a/docs-devsite/firestore_lite_pipelines.pipelinesnapshot.md +++ b/docs-devsite/firestore_lite_pipelines.pipelinesnapshot.md @@ -15,7 +15,7 @@ https://github.com/firebase/firebase-js-sdk Represents the results of a Firestore pipeline execution. -A `PipelineSnapshot` contains zero or more objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. +A `PipelineSnapshot` contains zero or more [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. Signature: @@ -33,7 +33,7 @@ export declare class PipelineSnapshot | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [executionTime](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshotexecutiontime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | (Public Preview) The time at which the pipeline producing this result is executed. {Timestamp} | +| [executionTime](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshotexecutiontime) | | [Timestamp](./firestore_lite.timestamp.md#timestamp_class) | (Public Preview) The time at which the pipeline producing this result is executed. | | [results](./firestore_lite_pipelines.pipelinesnapshot.md#pipelinesnapshotresults) | | [PipelineResult](./firestore_lite_pipelines.pipelineresult.md#pipelineresult_class)\[\] | (Public Preview) An array of all the results in the PipelineSnapshot. | ## PipelineSnapshot.(constructor) @@ -64,8 +64,6 @@ constructor(pipeline: Pipeline, results: PipelineResult[], executionTime?: Times The time at which the pipeline producing this result is executed. - {Timestamp} - Signature: ```typescript diff --git a/docs-devsite/firestore_lite_pipelines.pipelinesource.md b/docs-devsite/firestore_lite_pipelines.pipelinesource.md index 6ec4d729fa..e42b7b66ec 100644 --- a/docs-devsite/firestore_lite_pipelines.pipelinesource.md +++ b/docs-devsite/firestore_lite_pipelines.pipelinesource.md @@ -13,9 +13,9 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Provides the entry point for defining the data source of a Firestore . +Provides the entry point for defining the data source of a Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class). -Use the methods of this class (e.g., , , , or ) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. +Use the methods of this class (e.g., [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection), [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup), [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase), or [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments)) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. Signature: @@ -154,7 +154,7 @@ createFrom(query: Query): Pipeline; #### Exceptions - Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. +`FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. ## PipelineSource.database() @@ -220,7 +220,7 @@ PipelineType #### Exceptions - Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. +`FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. ## PipelineSource.documents() @@ -247,5 +247,5 @@ PipelineType #### Exceptions - Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. +`FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. diff --git a/docs-devsite/firestore_lite_pipelines.vectorvalue.md b/docs-devsite/firestore_lite_pipelines.vectorvalue.md index 19a69f0bc2..3afe1d51f3 100644 --- a/docs-devsite/firestore_lite_pipelines.vectorvalue.md +++ b/docs-devsite/firestore_lite_pipelines.vectorvalue.md @@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk # VectorValue class Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). - VectorValue - Signature: ```typescript diff --git a/docs-devsite/firestore_pipelines.aggregatefunction.md b/docs-devsite/firestore_pipelines.aggregatefunction.md index 5373c05e5a..37b927d28d 100644 --- a/docs-devsite/firestore_pipelines.aggregatefunction.md +++ b/docs-devsite/firestore_pipelines.aggregatefunction.md @@ -37,14 +37,7 @@ export declare class AggregateFunction | Method | Modifiers | Description | | --- | --- | --- | -| [as(name)](./firestore_pipelines.aggregatefunction.md#aggregatefunctionas) | | (Public Preview) Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document. -```typescript -// Calculate the average price of all items and assign it the alias "averagePrice". -firestore.pipeline().collection("items") - .aggregate(field("price").average().as("averagePrice")); - -``` - | +| [as(name)](./firestore_pipelines.aggregatefunction.md#aggregatefunctionas) | | (Public Preview) Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document. | ## AggregateFunction.(constructor) @@ -84,13 +77,6 @@ exprType: ExpressionType; Assigns an alias to this AggregateFunction. The alias specifies the name that the aggregated value will have in the output document. -```typescript -// Calculate the average price of all items and assign it the alias "averagePrice". -firestore.pipeline().collection("items") - .aggregate(field("price").average().as("averagePrice")); - -``` - Signature: ```typescript @@ -101,9 +87,21 @@ as(name: string): AliasedAggregate; | Parameter | Type | Description | | --- | --- | --- | -| name | string | The alias to assign to this AggregateFunction. A new that wraps this AggregateFunction and associates it with the provided alias. | +| name | string | The alias to assign to this AggregateFunction. | Returns: [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) +A new [AliasedAggregate](./firestore_pipelines.aliasedaggregate.md#aliasedaggregate_class) that wraps this AggregateFunction and associates it with the provided alias. + +### Example + + +```typescript +// Calculate the average price of all items and assign it the alias "averagePrice". +firestore.pipeline().collection("items") + .aggregate(field("price").average().as("averagePrice")); + +``` + diff --git a/docs-devsite/firestore_pipelines.booleanexpression.md b/docs-devsite/firestore_pipelines.booleanexpression.md index b4855ea111..4717d34e96 100644 --- a/docs-devsite/firestore_pipelines.booleanexpression.md +++ b/docs-devsite/firestore_pipelines.booleanexpression.md @@ -26,57 +26,13 @@ export declare abstract class BooleanExpression extends Expression | Method | Modifiers | Description | | --- | --- | --- | -| [conditional(thenExpr, elseExpr)](./firestore_pipelines.booleanexpression.md#booleanexpressionconditional) | | (Public Preview) Creates a conditional expression that evaluates to the 'then' expression if this expression evaluates to true, or evaluates to the 'else' expression if this expressions evaluates false. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor")); - -``` - | -| [countIf()](./firestore_pipelines.booleanexpression.md#booleanexpressioncountif) | | (Public Preview) Creates an aggregation that finds the count of input documents satisfying this boolean expression. -```typescript -// Find the count of documents with a score greater than 90 -field("score").greaterThan(90).countIf().as("highestScore"); - -``` - A new AggregateFunction representing the 'countIf' aggregation. | -| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(constant(false)); - -``` - | -| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(false); - -``` - | -| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(constant(0)); - -``` - | -| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(0); - -``` - | -| [not()](./firestore_pipelines.booleanexpression.md#booleanexpressionnot) | | (Public Preview) Creates an expression that negates this boolean expression. -```typescript -// Find documents where the 'tags' field does not contain 'completed' -field("tags").arrayContains("completed").not(); - -``` - A new representing the negated filter condition. | +| [conditional(thenExpr, elseExpr)](./firestore_pipelines.booleanexpression.md#booleanexpressionconditional) | | (Public Preview) Creates a conditional expression that evaluates to the 'then' expression if this expression evaluates to true, or evaluates to the 'else' expression if this expressions evaluates false. | +| [countIf()](./firestore_pipelines.booleanexpression.md#booleanexpressioncountif) | | (Public Preview) Creates an aggregation that finds the count of input documents satisfying this boolean expression. | +| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_pipelines.booleanexpression.md#booleanexpressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [not()](./firestore_pipelines.booleanexpression.md#booleanexpressionnot) | | (Public Preview) Creates an expression that negates this boolean expression. | ## BooleanExpression.conditional() @@ -85,12 +41,6 @@ field("tags").arrayContains("completed").not(); Creates a conditional expression that evaluates to the 'then' expression if `this` expression evaluates to `true`, or evaluates to the 'else' expression if `this` expressions evaluates `false`. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor")); - -``` - Signature: ```typescript @@ -102,25 +52,29 @@ conditional(thenExpr: Expression, elseExpr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | thenExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is true. | -| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. A new representing the conditional expression. | +| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## BooleanExpression.countIf() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the conditional expression. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the count of input documents satisfying this boolean expression. ```typescript -// Find the count of documents with a score greater than 90 -field("score").greaterThan(90).countIf().as("highestScore"); +// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". +field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor")); ``` - A new `AggregateFunction` representing the 'countIf' aggregation. + +## BooleanExpression.countIf() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the count of input documents satisfying this boolean expression. Signature: @@ -131,20 +85,24 @@ countIf(): AggregateFunction; [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -## BooleanExpression.ifError() +A new `AggregateFunction` representing the 'countIf' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(constant(false)); +// Find the count of documents with a score greater than 90 +field("score").greaterThan(90).countIf().as("highestScore"); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -155,26 +113,31 @@ ifError(catchValue: BooleanExpression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The value that will be returned if this expression produces an error. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## BooleanExpression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript // Create an expression that protects against a divide by zero error // but always returns a boolean expression. -constant(50).divide('length').gt(1).ifError(false); +constant(50).divide('length').gt(1).ifError(constant(false)); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -185,25 +148,31 @@ ifError(catchValue: boolean): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | boolean | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | boolean | The value that will be returned if this expression produces an error. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## BooleanExpression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript -// Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(constant(0)); +// Create an expression that protects against a divide by zero error +// but always returns a boolean expression. +constant(50).divide('length').gt(1).ifError(false); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -214,25 +183,30 @@ ifError(catchValue: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | [Expression](./firestore_pipelines.expression.md#expression_class) | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | [Expression](./firestore_pipelines.expression.md#expression_class) | The value that will be returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## BooleanExpression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript // Create an expression that protects against a divide by zero error. -constant(50).divide('length').gt(1).ifError(0); +constant(50).divide('length').gt(1).ifError(constant(0)); ``` +## BooleanExpression.ifError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. + Signature: ```typescript @@ -243,25 +217,29 @@ ifError(catchValue: unknown): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | unknown | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | unknown | The value that will be returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## BooleanExpression.not() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that negates this boolean expression. ```typescript -// Find documents where the 'tags' field does not contain 'completed' -field("tags").arrayContains("completed").not(); +// Create an expression that protects against a divide by zero error. +constant(50).divide('length').gt(1).ifError(0); ``` - A new representing the negated filter condition. + +## BooleanExpression.not() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that negates this boolean expression. Signature: @@ -272,3 +250,14 @@ not(): BooleanExpression; [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the negated filter condition. + +### Example + + +```typescript +// Find documents where the 'tags' field does not contain 'completed' +field("tags").arrayContains("completed").not(); + +``` + diff --git a/docs-devsite/firestore_pipelines.expression.md b/docs-devsite/firestore_pipelines.expression.md index c082bbfd5f..5c74487ae5 100644 --- a/docs-devsite/firestore_pipelines.expression.md +++ b/docs-devsite/firestore_pipelines.expression.md @@ -13,13 +13,13 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Represents an expression that can be evaluated to a value within the execution of a . +Represents an expression that can be evaluated to a value within the execution of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class). Expressions are the building blocks for creating complex queries and transformations in Firestore pipelines. They can represent: - \*\*Field references:\*\* Access values from document fields. - \*\*Literals:\*\* Represent constant values (strings, numbers, booleans). - \*\*Function calls:\*\* Apply functions to one or more expressions. -The `Expr` class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. +The `Expression` class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. Signature: @@ -37,821 +37,134 @@ export declare abstract class Expression | Method | Modifiers | Description | | --- | --- | --- | -| [abs()](./firestore_pipelines.expression.md#expressionabs) | | (Public Preview) Creates an expression that computes the absolute value of a numeric value. -```typescript -// Compute the absolute value of the 'price' field. -field("price").abs(); - -``` - A new representing the absolute value of the numeric value. | -| [add(second)](./firestore_pipelines.expression.md#expressionadd) | | (Public Preview) Creates an expression that adds this expression to another expression. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -field("quantity").add(field("reserve")); - -``` - | -| [arrayConcat(secondArray, otherArrays)](./firestore_pipelines.expression.md#expressionarrayconcat) | | (Public Preview) Creates an expression that concatenates an array expression with one or more other arrays. -```typescript -// Combine the 'items' array with another array field. -field("items").arrayConcat(field("otherItems")); - -``` - | -| [arrayContains(expression)](./firestore_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific element. -```typescript -// Check if the 'sizes' array contains the value from the 'selectedSize' field -field("sizes").arrayContains(field("selectedSize")); - -``` - | -| [arrayContains(value)](./firestore_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific value. -```typescript -// Check if the 'colors' array contains "red" -field("colors").arrayContains("red"); - -``` - | -| [arrayContainsAll(values)](./firestore_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. -```typescript -// Check if the 'tags' array contains both the value in field "tag1" and the literal value "tag2" -field("tags").arrayContainsAll([field("tag1"), "tag2"]); - -``` - | -| [arrayContainsAll(arrayExpression)](./firestore_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. -```typescript -// Check if the 'tags' array contains both of the values from field "tag1" and the literal value "tag2" -field("tags").arrayContainsAll(array([field("tag1"), "tag2"])); - -``` - | -| [arrayContainsAny(values)](./firestore_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. -```typescript -// Check if the 'categories' array contains either values from field "cate1" or "cate2" -field("categories").arrayContainsAny([field("cate1"), field("cate2")]); - -``` - | -| [arrayContainsAny(arrayExpression)](./firestore_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. -```typescript -// Check if the 'groups' array contains either the value from the 'userGroup' field -// or the value "guest" -field("groups").arrayContainsAny(array([field("userGroup"), "guest"])); - -``` - | -| [arrayGet(offset)](./firestore_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the 'tags' field array at index `1`. -field('tags').arrayGet(1); - -``` - | -| [arrayGet(offsetExpr)](./firestore_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -field('tags').arrayGet(field('favoriteTag')); - -``` - | -| [arrayLength()](./firestore_pipelines.expression.md#expressionarraylength) | | (Public Preview) Creates an expression that calculates the length of an array. -```typescript -// Get the number of items in the 'cart' array -field("cart").arrayLength(); - -``` - A new Expr representing the length of the array. | -| [arrayReverse()](./firestore_pipelines.expression.md#expressionarrayreverse) | | (Public Preview) Creates an expression that reverses an array. -```typescript -// Reverse the value of the 'myArray' field. -field("myArray").arrayReverse(); - -``` - A new representing the reversed array. | -| [arraySum()](./firestore_pipelines.expression.md#expressionarraysum) | | (Public Preview) Creates an expression that computes the sum of the elements in an array. -```typescript -// Compute the sum of the elements in the 'scores' field. -field("scores").arraySum(); - -``` - A new representing the sum of the elements in the array. | -| [as(name)](./firestore_pipelines.expression.md#expressionas) | | (Public Preview) Assigns an alias to this expression.Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values. -```typescript -// Calculate the total price and assign it the alias "totalPrice" and add it to the output. -firestore.pipeline().collection("items") - .addFields(field("price").multiply(field("quantity")).as("totalPrice")); - -``` - | -| [asBoolean()](./firestore_pipelines.expression.md#expressionasboolean) | | (Public Preview) Wraps the expression in a \[BooleanExpression\]. A \[BooleanExpression\] representing the same expression. | -| [ascending()](./firestore_pipelines.expression.md#expressionascending) | | (Public Preview) Creates an that sorts documents in ascending order based on this expression. -```typescript -// Sort documents by the 'name' field in ascending order -pipeline().collection("users") - .sort(field("name").ascending()); - -``` - A new Ordering for ascending sorting. | -| [average()](./firestore_pipelines.expression.md#expressionaverage) | | (Public Preview) Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. -```typescript -// Calculate the average age of users -field("age").average().as("averageAge"); - -``` - A new AggregateFunction representing the 'average' aggregation. | -| [byteLength()](./firestore_pipelines.expression.md#expressionbytelength) | | (Public Preview) Creates an expression that calculates the length of this string expression in bytes. -```typescript -// Calculate the length of the 'myString' field in bytes. -field("myString").byteLength(); - -``` - A new representing the length of the string in bytes. | -| [ceil()](./firestore_pipelines.expression.md#expressionceil) | | (Public Preview) Creates an expression that computes the ceiling of a numeric value. -```typescript -// Compute the ceiling of the 'price' field. -field("price").ceil(); - -``` - A new representing the ceiling of the numeric value. | -| [charLength()](./firestore_pipelines.expression.md#expressioncharlength) | | (Public Preview) Creates an expression that calculates the character length of a string in UTF-8. -```typescript -// Get the character length of the 'name' field in its UTF-8 form. -field("name").charLength(); - -``` - A new Expr representing the length of the string. | -| [collectionId()](./firestore_pipelines.expression.md#expressioncollectionid) | | (Public Preview) Creates an expression that returns the collection ID from a path. -```typescript -// Get the collection ID from a path. -field("__path__").collectionId(); - -``` - A new representing the collectionId operation. | -| [concat(second, others)](./firestore_pipelines.expression.md#expressionconcat) | | (Public Preview) Creates an expression that concatenates expression results together. -```typescript -// Combine the 'firstName', ' ', and 'lastName' fields into a single value. -field("firstName").concat(constant(" "), field("lastName")); - -``` - | -| [cosineDistance(vectorExpression)](./firestore_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the cosine distance between two vectors. -```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -field("userVector").cosineDistance(field("itemVector")); - -``` - | -| [cosineDistance(vector)](./firestore_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the Cosine distance between two vectors. -```typescript -// Calculate the Cosine distance between the 'location' field and a target location -field("location").cosineDistance(new VectorValue([37.7749, -122.4194])); - -``` - | -| [count()](./firestore_pipelines.expression.md#expressioncount) | | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. -```typescript -// Count the total number of products -field("productId").count().as("totalProducts"); - -``` - A new AggregateFunction representing the 'count' aggregation. | -| [countDistinct()](./firestore_pipelines.expression.md#expressioncountdistinct) | | (Public Preview) Creates an aggregation that counts the number of distinct values of the expression or field. -```typescript -// Count the distinct number of products -field("productId").countDistinct().as("distinctProducts"); - -``` - A new AggregateFunction representing the 'count\_distinct' aggregation. | -| [descending()](./firestore_pipelines.expression.md#expressiondescending) | | (Public Preview) Creates an that sorts documents in descending order based on this expression. -```typescript -// Sort documents by the 'createdAt' field in descending order -firestore.pipeline().collection("users") - .sort(field("createdAt").descending()); - -``` - A new Ordering for descending sorting. | -| [divide(divisor)](./firestore_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by another expression. -```typescript -// Divide the 'total' field by the 'count' field -field("total").divide(field("count")); - -``` - | -| [divide(divisor)](./firestore_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by a constant value. -```typescript -// Divide the 'value' field by 10 -field("value").divide(10); - -``` - | -| [documentId()](./firestore_pipelines.expression.md#expressiondocumentid) | | (Public Preview) Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -field("__path__").documentId(); - -``` - A new representing the documentId operation. | -| [dotProduct(vectorExpression)](./firestore_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. -```typescript -// Calculate the dot product between a feature vector and a target vector -field("features").dotProduct([0.5, 0.8, 0.2]); - -``` - | -| [dotProduct(vector)](./firestore_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. -```typescript -// Calculate the dot product between a feature vector and a target vector -field("features").dotProduct(new VectorValue([0.5, 0.8, 0.2])); - -``` - | -| [endsWith(suffix)](./firestore_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix. -```typescript -// Check if the 'filename' field ends with ".txt" -field("filename").endsWith(".txt"); - -``` - | -| [endsWith(suffix)](./firestore_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix (represented as an expression). -```typescript -// Check if the 'url' field ends with the value of the 'extension' field -field("url").endsWith(field("extension")); - -``` - | -| [equal(expression)](./firestore_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to another expression. -```typescript -// Check if the 'age' field is equal to 21 -field("age").equal(21); - -``` - | -| [equal(value)](./firestore_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to a constant value. -```typescript -// Check if the 'city' field is equal to "London" -field("city").equal("London"); - -``` - | -| [equalAny(values)](./firestore_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -field("category").equalAny("Electronics", field("primaryType")); - -``` - | -| [equalAny(arrayExpression)](./firestore_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -field("category").equalAny(array(["Electronics", field("primaryType")])); - -``` - | -| [euclideanDistance(vectorExpression)](./firestore_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location -field("location").euclideanDistance([37.7749, -122.4194]); - -``` - | -| [euclideanDistance(vector)](./firestore_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location -field("location").euclideanDistance(new VectorValue([37.7749, -122.4194])); - -``` - | -| [exists()](./firestore_pipelines.expression.md#expressionexists) | | (Public Preview) Creates an expression that checks if a field exists in the document. -```typescript -// Check if the document has a field named "phoneNumber" -field("phoneNumber").exists(); - -``` - A new Expr representing the 'exists' check. | -| [exp()](./firestore_pipelines.expression.md#expressionexp) | | (Public Preview) Creates an expression that computes e to the power of this expression. -```typescript -// Compute e to the power of the 'value' field. -field("value").exp(); - -``` - A new representing the exp of the numeric value. | -| [floor()](./firestore_pipelines.expression.md#expressionfloor) | | (Public Preview) Creates an expression that computes the floor of a numeric value. -```typescript -// Compute the floor of the 'price' field. -field("price").floor(); - -``` - A new representing the floor of the numeric value. | -| [greaterThan(expression)](./firestore_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than another expression. -```typescript -// Check if the 'age' field is greater than the 'limit' field -field("age").greaterThan(field("limit")); - -``` - | -| [greaterThan(value)](./firestore_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than a constant value. -```typescript -// Check if the 'price' field is greater than 100 -field("price").greaterThan(100); - -``` - | -| [greaterThanOrEqual(expression)](./firestore_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to another expression. -```typescript -// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1 -field("quantity").greaterThanOrEqual(field('requirement').add(1)); - -``` - | -| [greaterThanOrEqual(value)](./firestore_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to a constant value. -```typescript -// Check if the 'score' field is greater than or equal to 80 -field("score").greaterThanOrEqual(80); - -``` - | -| [ifAbsent(elseValue)](./firestore_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of the this expression evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -field("optional_field").ifAbsent("default_value") - -``` - | -| [ifAbsent(elseExpression)](./firestore_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of this expression evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or if that is -// absent, then returns the value of the field ` -field("optional_field").ifAbsent(field('default_field')) - -``` - | -| [ifError(catchExpr)](./firestore_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the result of the catchExpr argument if there is an error, else return the result of this expression. -```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -field("title").arrayGet(0).ifError(field("title")); - -``` - | -| [ifError(catchValue)](./firestore_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. -```typescript -// Returns the first item in the title field arrays, or returns -// "Default Title" -field("title").arrayGet(0).ifError("Default Title"); - -``` - | -| [isAbsent()](./firestore_pipelines.expression.md#expressionisabsent) | | (Public Preview) Creates an expression that returns true if the result of this expression is absent. Otherwise, returns false even if the value is null. -```typescript -// Check if the field `value` is absent. -field("value").isAbsent(); - -``` - A new representing the 'isAbsent' check. | -| [isError()](./firestore_pipelines.expression.md#expressioniserror) | | (Public Preview) Creates an expression that checks if a given expression produces an error. -```typescript -// Check if the result of a calculation is an error -field("title").arrayContains(1).isError(); - -``` - A new representing the 'isError' check. | -| [join(delimiterExpression)](./firestore_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -field("tags").join(field("separator")) - -``` - | -| [join(delimiter)](./firestore_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array field into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -field("tags").join(", ") - -``` - | -| [length()](./firestore_pipelines.expression.md#expressionlength) | | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. -```typescript -// Get the length of the 'name' field. -field("name").length(); - -// Get the number of items in the 'cart' array. -field("cart").length(); - -``` - A new Expr representing the length of the string, array, map, vector, or bytes. | -| [lessThan(experession)](./firestore_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than another expression. -```typescript -// Check if the 'age' field is less than 'limit' -field("age").lessThan(field('limit')); - -``` - | -| [lessThan(value)](./firestore_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than a constant value. -```typescript -// Check if the 'price' field is less than 50 -field("price").lessThan(50); - -``` - | -| [lessThanOrEqual(expression)](./firestore_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to another expression. -```typescript -// Check if the 'quantity' field is less than or equal to 20 -field("quantity").lessThan(constant(20)); - -``` - | -| [lessThanOrEqual(value)](./firestore_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to a constant value. -```typescript -// Check if the 'score' field is less than or equal to 70 -field("score").lessThan(70); - -``` - | -| [like(pattern)](./firestore_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. -```typescript -// Check if the 'title' field contains the word "guide" (case-sensitive) -field("title").like("%guide%"); - -``` - | -| [like(pattern)](./firestore_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. -```typescript -// Check if the 'title' field contains the word "guide" (case-sensitive) -field("title").like("%guide%"); - -``` - | -| [ln()](./firestore_pipelines.expression.md#expressionln) | | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. -```typescript -// Compute the natural logarithm of the 'value' field. -field("value").ln(); - -``` - A new representing the natural logarithm of the numeric value. | -| [log10()](./firestore_pipelines.expression.md#expressionlog10) | | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. -```typescript -// Compute the base-10 logarithm of the 'value' field. -field("value").log10(); - -``` - A new representing the base-10 logarithm of the numeric value. | -| [logicalMaximum(second, others)](./firestore_pipelines.expression.md#expressionlogicalmaximum) | | (Public Preview) Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. -```typescript -// Returns the larger value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMaximum(Function.currentTimestamp()); - -``` - | -| [logicalMinimum(second, others)](./firestore_pipelines.expression.md#expressionlogicalminimum) | | (Public Preview) Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. -```typescript -// Returns the smaller value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMinimum(Function.currentTimestamp()); - -``` - | -| [mapGet(subfield)](./firestore_pipelines.expression.md#expressionmapget) | | (Public Preview) Accesses a value from a map (object) field using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -field("address").mapGet("city"); - -``` - | -| [mapMerge(secondMap, otherMaps)](./firestore_pipelines.expression.md#expressionmapmerge) | | (Public Preview) Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -field('settings').mapMerge({ enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - | -| [mapRemove(key)](./firestore_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. -``` -// Removes the key 'baz' from the input map. -map({foo: 'bar', baz: true}).mapRemove('baz'); - -``` - | -| [mapRemove(keyExpr)](./firestore_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. -``` -// Removes the key 'baz' from the input map. -map({foo: 'bar', baz: true}).mapRemove(constant('baz')); - -``` - | -| [maximum()](./firestore_pipelines.expression.md#expressionmaximum) | | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -field("score").maximum().as("highestScore"); - -``` - A new AggregateFunction representing the 'maximum' aggregation. | -| [minimum()](./firestore_pipelines.expression.md#expressionminimum) | | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. -```typescript -// Find the lowest price of all products -field("price").minimum().as("lowestPrice"); - -``` - A new AggregateFunction representing the 'minimum' aggregation. | -| [mod(expression)](./firestore_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. -```typescript -// Calculate the remainder of dividing the 'value' field by the 'divisor' field -field("value").mod(field("divisor")); - -``` - | -| [mod(value)](./firestore_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. -```typescript -// Calculate the remainder of dividing the 'value' field by 10 -field("value").mod(10); - -``` - | -| [multiply(second)](./firestore_pipelines.expression.md#expressionmultiply) | | (Public Preview) Creates an expression that multiplies this expression by another expression. -```typescript -// Multiply the 'quantity' field by the 'price' field -field("quantity").multiply(field("price")); - -``` - | -| [notEqual(expression)](./firestore_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to another expression. -```typescript -// Check if the 'status' field is not equal to "completed" -field("status").notEqual("completed"); - -``` - | -| [notEqual(value)](./firestore_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to a constant value. -```typescript -// Check if the 'country' field is not equal to "USA" -field("country").notEqual("USA"); - -``` - | -| [notEqualAny(values)](./firestore_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -field("status").notEqualAny(["pending", field("rejectedStatus")]); - -``` - | -| [notEqualAny(arrayExpression)](./firestore_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. -```typescript -// Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' -field("status").notEqualAny(field('rejectedStatuses')); - -``` - | -| [pow(exponent)](./firestore_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of another expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -field("base").pow(field("exponent")); - -``` - | -| [pow(exponent)](./firestore_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of a constant value. -```typescript -// Raise the value of the 'base' field to the power of 2. -field("base").pow(2); - -``` - | -| [regexContains(pattern)](./firestore_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -field("description").regexContains("(?i)example"); - -``` - | -| [regexContains(pattern)](./firestore_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains the regular expression stored in field 'regex' -field("description").regexContains(field("regex")); - -``` - | -| [regexMatch(pattern)](./firestore_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -field("email").regexMatch("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); - -``` - | -| [regexMatch(pattern)](./firestore_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. -```typescript -// Check if the 'email' field matches a regular expression stored in field 'regex' -field("email").regexMatch(field("regex")); - -``` - | -| [reverse()](./firestore_pipelines.expression.md#expressionreverse) | | (Public Preview) Creates an expression that reverses this string expression. -```typescript -// Reverse the value of the 'myString' field. -field("myString").reverse(); - -``` - A new representing the reversed string. | -| [round()](./firestore_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. -```typescript -// Round the value of the 'price' field. -field("price").round(); - -``` - A new Expr representing the rounded value. | -| [round(decimalPlaces)](./firestore_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -field("price").round(2); - -``` - | -| [round(decimalPlaces)](./firestore_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. +| [abs()](./firestore_pipelines.expression.md#expressionabs) | | (Public Preview) Creates an expression that computes the absolute value of a numeric value. | +| [add(second)](./firestore_pipelines.expression.md#expressionadd) | | (Public Preview) Creates an expression that adds this expression to another expression. | +| [arrayConcat(secondArray, otherArrays)](./firestore_pipelines.expression.md#expressionarrayconcat) | | (Public Preview) Creates an expression that concatenates an array expression with one or more other arrays. | +| [arrayContains(expression)](./firestore_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific element. | +| [arrayContains(value)](./firestore_pipelines.expression.md#expressionarraycontains) | | (Public Preview) Creates an expression that checks if an array contains a specific value. | +| [arrayContainsAll(values)](./firestore_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. | +| [arrayContainsAll(arrayExpression)](./firestore_pipelines.expression.md#expressionarraycontainsall) | | (Public Preview) Creates an expression that checks if an array contains all the specified elements. | +| [arrayContainsAny(values)](./firestore_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. | +| [arrayContainsAny(arrayExpression)](./firestore_pipelines.expression.md#expressionarraycontainsany) | | (Public Preview) Creates an expression that checks if an array contains any of the specified elements. | +| [arrayGet(offset)](./firestore_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayGet(offsetExpr)](./firestore_pipelines.expression.md#expressionarrayget) | | (Public Preview) Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayLength()](./firestore_pipelines.expression.md#expressionarraylength) | | (Public Preview) Creates an expression that calculates the length of an array. | +| [arrayReverse()](./firestore_pipelines.expression.md#expressionarrayreverse) | | (Public Preview) Creates an expression that reverses an array. | +| [arraySum()](./firestore_pipelines.expression.md#expressionarraysum) | | (Public Preview) Creates an expression that computes the sum of the elements in an array. | +| [as(name)](./firestore_pipelines.expression.md#expressionas) | | (Public Preview) Assigns an alias to this expression.Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values. | +| [asBoolean()](./firestore_pipelines.expression.md#expressionasboolean) | | (Public Preview) Wraps the expression in a \[BooleanExpression\]. | +| [ascending()](./firestore_pipelines.expression.md#expressionascending) | | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on this expression. | +| [average()](./firestore_pipelines.expression.md#expressionaverage) | | (Public Preview) Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. | +| [byteLength()](./firestore_pipelines.expression.md#expressionbytelength) | | (Public Preview) Creates an expression that calculates the length of this string expression in bytes. | +| [ceil()](./firestore_pipelines.expression.md#expressionceil) | | (Public Preview) Creates an expression that computes the ceiling of a numeric value. | +| [charLength()](./firestore_pipelines.expression.md#expressioncharlength) | | (Public Preview) Creates an expression that calculates the character length of a string in UTF-8. | +| [collectionId()](./firestore_pipelines.expression.md#expressioncollectionid) | | (Public Preview) Creates an expression that returns the collection ID from a path. | +| [concat(second, others)](./firestore_pipelines.expression.md#expressionconcat) | | (Public Preview) Creates an expression that concatenates expression results together. | +| [cosineDistance(vectorExpression)](./firestore_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the cosine distance between two vectors. | +| [cosineDistance(vector)](./firestore_pipelines.expression.md#expressioncosinedistance) | | (Public Preview) Calculates the Cosine distance between two vectors. | +| [count()](./firestore_pipelines.expression.md#expressioncount) | | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. | +| [countDistinct()](./firestore_pipelines.expression.md#expressioncountdistinct) | | (Public Preview) Creates an aggregation that counts the number of distinct values of the expression or field. | +| [descending()](./firestore_pipelines.expression.md#expressiondescending) | | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on this expression. | +| [divide(divisor)](./firestore_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by another expression. | +| [divide(divisor)](./firestore_pipelines.expression.md#expressiondivide) | | (Public Preview) Creates an expression that divides this expression by a constant value. | +| [documentId()](./firestore_pipelines.expression.md#expressiondocumentid) | | (Public Preview) Creates an expression that returns the document ID from a path. | +| [dotProduct(vectorExpression)](./firestore_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. | +| [dotProduct(vector)](./firestore_pipelines.expression.md#expressiondotproduct) | | (Public Preview) Calculates the dot product between two vectors. | +| [endsWith(suffix)](./firestore_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix. | +| [endsWith(suffix)](./firestore_pipelines.expression.md#expressionendswith) | | (Public Preview) Creates an expression that checks if a string ends with a given postfix (represented as an expression). | +| [equal(expression)](./firestore_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to another expression. | +| [equal(value)](./firestore_pipelines.expression.md#expressionequal) | | (Public Preview) Creates an expression that checks if this expression is equal to a constant value. | +| [equalAny(values)](./firestore_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. | +| [equalAny(arrayExpression)](./firestore_pipelines.expression.md#expressionequalany) | | (Public Preview) Creates an expression that checks if this expression is equal to any of the provided values or expressions. | +| [euclideanDistance(vectorExpression)](./firestore_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. | +| [euclideanDistance(vector)](./firestore_pipelines.expression.md#expressioneuclideandistance) | | (Public Preview) Calculates the Euclidean distance between two vectors. | +| [exists()](./firestore_pipelines.expression.md#expressionexists) | | (Public Preview) Creates an expression that checks if a field exists in the document. | +| [exp()](./firestore_pipelines.expression.md#expressionexp) | | (Public Preview) Creates an expression that computes e to the power of this expression. | +| [floor()](./firestore_pipelines.expression.md#expressionfloor) | | (Public Preview) Creates an expression that computes the floor of a numeric value. | +| [greaterThan(expression)](./firestore_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than another expression. | +| [greaterThan(value)](./firestore_pipelines.expression.md#expressiongreaterthan) | | (Public Preview) Creates an expression that checks if this expression is greater than a constant value. | +| [greaterThanOrEqual(expression)](./firestore_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to another expression. | +| [greaterThanOrEqual(value)](./firestore_pipelines.expression.md#expressiongreaterthanorequal) | | (Public Preview) Creates an expression that checks if this expression is greater than or equal to a constant value. | +| [ifAbsent(elseValue)](./firestore_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of the this expression evaluation. | +| [ifAbsent(elseExpression)](./firestore_pipelines.expression.md#expressionifabsent) | | (Public Preview) Creates an expression that returns the elseValue argument if this expression results in an absent value, else return the result of this expression evaluation. ```typescript -// Round the value of the 'price' field to two decimal places. -field("price").round(constant(2)); +// Returns the value of the optional field 'optional_field', or if that is +// absent, then returns the value of the field ` +field("optional_field").ifAbsent(field('default_field')) ``` | +| [ifError(catchExpr)](./firestore_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the result of the catchExpr argument if there is an error, else return the result of this expression. | +| [ifError(catchValue)](./firestore_pipelines.expression.md#expressioniferror) | | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of this expression. | +| [isAbsent()](./firestore_pipelines.expression.md#expressionisabsent) | | (Public Preview) Creates an expression that returns true if the result of this expression is absent. Otherwise, returns false even if the value is null. | +| [isError()](./firestore_pipelines.expression.md#expressioniserror) | | (Public Preview) Creates an expression that checks if a given expression produces an error. | +| [join(delimiterExpression)](./firestore_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array into a string. | +| [join(delimiter)](./firestore_pipelines.expression.md#expressionjoin) | | (Public Preview) Creates an expression that joins the elements of an array field into a string. | +| [length()](./firestore_pipelines.expression.md#expressionlength) | | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. | +| [lessThan(experession)](./firestore_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than another expression. | +| [lessThan(value)](./firestore_pipelines.expression.md#expressionlessthan) | | (Public Preview) Creates an expression that checks if this expression is less than a constant value. | +| [lessThanOrEqual(expression)](./firestore_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to another expression. | +| [lessThanOrEqual(value)](./firestore_pipelines.expression.md#expressionlessthanorequal) | | (Public Preview) Creates an expression that checks if this expression is less than or equal to a constant value. | +| [like(pattern)](./firestore_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. | +| [like(pattern)](./firestore_pipelines.expression.md#expressionlike) | | (Public Preview) Creates an expression that performs a case-sensitive string comparison. | +| [ln()](./firestore_pipelines.expression.md#expressionln) | | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. | +| [log10()](./firestore_pipelines.expression.md#expressionlog10) | | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. | +| [logicalMaximum(second, others)](./firestore_pipelines.expression.md#expressionlogicalmaximum) | | (Public Preview) Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. | +| [logicalMinimum(second, others)](./firestore_pipelines.expression.md#expressionlogicalminimum) | | (Public Preview) Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. | +| [mapGet(subfield)](./firestore_pipelines.expression.md#expressionmapget) | | (Public Preview) Accesses a value from a map (object) field using the provided key. | +| [mapMerge(secondMap, otherMaps)](./firestore_pipelines.expression.md#expressionmapmerge) | | (Public Preview) Creates an expression that merges multiple map values. | +| [mapRemove(key)](./firestore_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. | +| [mapRemove(keyExpr)](./firestore_pipelines.expression.md#expressionmapremove) | | (Public Preview) Creates an expression that removes a key from the map produced by evaluating this expression. | +| [maximum()](./firestore_pipelines.expression.md#expressionmaximum) | | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. | +| [minimum()](./firestore_pipelines.expression.md#expressionminimum) | | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. | +| [mod(expression)](./firestore_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. | +| [mod(value)](./firestore_pipelines.expression.md#expressionmod) | | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. | +| [multiply(second)](./firestore_pipelines.expression.md#expressionmultiply) | | (Public Preview) Creates an expression that multiplies this expression by another expression. | +| [notEqual(expression)](./firestore_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to another expression. | +| [notEqual(value)](./firestore_pipelines.expression.md#expressionnotequal) | | (Public Preview) Creates an expression that checks if this expression is not equal to a constant value. | +| [notEqualAny(values)](./firestore_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the provided values or expressions. | +| [notEqualAny(arrayExpression)](./firestore_pipelines.expression.md#expressionnotequalany) | | (Public Preview) Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. | +| [pow(exponent)](./firestore_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of another expression. | +| [pow(exponent)](./firestore_pipelines.expression.md#expressionpow) | | (Public Preview) Creates an expression that returns the value of this expression raised to the power of a constant value. | +| [regexContains(pattern)](./firestore_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. | +| [regexContains(pattern)](./firestore_pipelines.expression.md#expressionregexcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified regular expression as a substring. | +| [regexMatch(pattern)](./firestore_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. | +| [regexMatch(pattern)](./firestore_pipelines.expression.md#expressionregexmatch) | | (Public Preview) Creates an expression that checks if a string matches a specified regular expression. | +| [reverse()](./firestore_pipelines.expression.md#expressionreverse) | | (Public Preview) Creates an expression that reverses this string expression. | +| [round()](./firestore_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. | +| [round(decimalPlaces)](./firestore_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | +| [round(decimalPlaces)](./firestore_pipelines.expression.md#expressionround) | | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | | [split(delimiter)](./firestore_pipelines.expression.md#expressionsplit) | | (Public Preview) Creates an expression that splits the result of this expression into an array of substrings based on the provided delimiter. | | [split(delimiter)](./firestore_pipelines.expression.md#expressionsplit) | | (Public Preview) Creates an expression that splits the result of this expression into an array of substrings based on the provided delimiter. | -| [sqrt()](./firestore_pipelines.expression.md#expressionsqrt) | | (Public Preview) Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -field("value").sqrt(); - -``` - A new representing the square root of the numeric value. | -| [startsWith(prefix)](./firestore_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix. -```typescript -// Check if the 'name' field starts with "Mr." -field("name").startsWith("Mr."); - -``` - | -| [startsWith(prefix)](./firestore_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix (represented as an expression). -```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -field("fullName").startsWith(field("firstName")); - -``` - | -| [stringConcat(secondString, otherStrings)](./firestore_pipelines.expression.md#expressionstringconcat) | | (Public Preview) Creates an expression that concatenates string expressions together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -field("firstName").stringConcat(constant(" "), field("lastName")); - -``` - | -| [stringContains(substring)](./firestore_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified substring. -```typescript -// Check if the 'description' field contains "example". -field("description").stringContains("example"); - -``` - | -| [stringContains(expr)](./firestore_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains the string represented by another expression. -```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -field("description").stringContains(field("keyword")); - -``` - | -| [stringReverse()](./firestore_pipelines.expression.md#expressionstringreverse) | | (Public Preview) Creates an expression that reverses a string. -```typescript -// Reverse the value of the 'myString' field. -field("myString").stringReverse(); - -``` - A new representing the reversed string. | +| [sqrt()](./firestore_pipelines.expression.md#expressionsqrt) | | (Public Preview) Creates an expression that computes the square root of a numeric value. | +| [startsWith(prefix)](./firestore_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix. | +| [startsWith(prefix)](./firestore_pipelines.expression.md#expressionstartswith) | | (Public Preview) Creates an expression that checks if a string starts with a given prefix (represented as an expression). | +| [stringConcat(secondString, otherStrings)](./firestore_pipelines.expression.md#expressionstringconcat) | | (Public Preview) Creates an expression that concatenates string expressions together. | +| [stringContains(substring)](./firestore_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains a specified substring. | +| [stringContains(expr)](./firestore_pipelines.expression.md#expressionstringcontains) | | (Public Preview) Creates an expression that checks if a string contains the string represented by another expression. | +| [stringReverse()](./firestore_pipelines.expression.md#expressionstringreverse) | | (Public Preview) Creates an expression that reverses a string. | | [substring(position, length)](./firestore_pipelines.expression.md#expressionsubstring) | | (Public Preview) Creates an expression that returns a substring of the results of this expression. | | [substring(position, length)](./firestore_pipelines.expression.md#expressionsubstring) | | (Public Preview) Creates an expression that returns a substring of the results of this expression. | -| [subtract(subtrahend)](./firestore_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts another expression from this expression. -```typescript -// Subtract the 'discount' field from the 'price' field -field("price").subtract(field("discount")); - -``` - | -| [subtract(subtrahend)](./firestore_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts a constant value from this expression. -```typescript -// Subtract 20 from the value of the 'total' field -field("total").subtract(20); - -``` - | -| [sum()](./firestore_pipelines.expression.md#expressionsum) | | (Public Preview) Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -field("orderAmount").sum().as("totalRevenue"); - -``` - A new AggregateFunction representing the 'sum' aggregation. | -| [timestampAdd(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. -```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -field("timestamp").timestampAdd(field("unit"), field("amount")); - -``` - | -| [timestampAdd(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. -```typescript -// Add 1 day to the 'timestamp' field. -field("timestamp").timestampAdd("day", 1); - -``` - | -| [timestampSubtract(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. -```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -field("timestamp").timestampSubtract(field("unit"), field("amount")); - -``` - | -| [timestampSubtract(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. -```typescript -// Subtract 1 day from the 'timestamp' field. -field("timestamp").timestampSubtract("day", 1); - -``` - | -| [timestampToUnixMicros()](./firestore_pipelines.expression.md#expressiontimestamptounixmicros) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to microseconds since epoch. -field("timestamp").timestampToUnixMicros(); - -``` - A new representing the number of microseconds since epoch. | -| [timestampToUnixMillis()](./firestore_pipelines.expression.md#expressiontimestamptounixmillis) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -field("timestamp").timestampToUnixMillis(); - -``` - A new representing the number of milliseconds since epoch. | -| [timestampToUnixSeconds()](./firestore_pipelines.expression.md#expressiontimestamptounixseconds) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to seconds since epoch. -field("timestamp").timestampToUnixSeconds(); - -``` - A new representing the number of seconds since epoch. | +| [subtract(subtrahend)](./firestore_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts another expression from this expression. | +| [subtract(subtrahend)](./firestore_pipelines.expression.md#expressionsubtract) | | (Public Preview) Creates an expression that subtracts a constant value from this expression. | +| [sum()](./firestore_pipelines.expression.md#expressionsum) | | (Public Preview) Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs. | +| [timestampAdd(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. | +| [timestampAdd(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampadd) | | (Public Preview) Creates an expression that adds a specified amount of time to this timestamp expression. | +| [timestampSubtract(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. | +| [timestampSubtract(unit, amount)](./firestore_pipelines.expression.md#expressiontimestampsubtract) | | (Public Preview) Creates an expression that subtracts a specified amount of time from this timestamp expression. | +| [timestampToUnixMicros()](./firestore_pipelines.expression.md#expressiontimestamptounixmicros) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixMillis()](./firestore_pipelines.expression.md#expressiontimestamptounixmillis) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixSeconds()](./firestore_pipelines.expression.md#expressiontimestamptounixseconds) | | (Public Preview) Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). | | [timestampTruncate(granularity, timezone)](./firestore_pipelines.expression.md#expressiontimestamptruncate) | | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | | [timestampTruncate(granularity, timezone)](./firestore_pipelines.expression.md#expressiontimestamptruncate) | | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | -| [toLower()](./firestore_pipelines.expression.md#expressiontolower) | | (Public Preview) Creates an expression that converts a string to lowercase. -```typescript -// Convert the 'name' field to lowercase -field("name").toLower(); - -``` - A new Expr representing the lowercase string. | -| [toUpper()](./firestore_pipelines.expression.md#expressiontoupper) | | (Public Preview) Creates an expression that converts a string to uppercase. -```typescript -// Convert the 'title' field to uppercase -field("title").toUpper(); - -``` - A new Expr representing the uppercase string. | -| [trim(valueToTrim)](./firestore_pipelines.expression.md#expressiontrim) | | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array. -```typescript -// Trim whitespace from the 'userInput' field -field("userInput").trim(); - -// Trim quotes from the 'userInput' field -field("userInput").trim('"'); - -``` - | +| [toLower()](./firestore_pipelines.expression.md#expressiontolower) | | (Public Preview) Creates an expression that converts a string to lowercase. | +| [toUpper()](./firestore_pipelines.expression.md#expressiontoupper) | | (Public Preview) Creates an expression that converts a string to uppercase. | +| [trim(valueToTrim)](./firestore_pipelines.expression.md#expressiontrim) | | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array. | | [type()](./firestore_pipelines.expression.md#expressiontype) | | (Public Preview) Creates an expression that returns the data type of this expression's result, as a string. | -| [unixMicrosToTimestamp()](./firestore_pipelines.expression.md#expressionunixmicrostotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -field("microseconds").unixMicrosToTimestamp(); - -``` - A new representing the timestamp. | -| [unixMillisToTimestamp()](./firestore_pipelines.expression.md#expressionunixmillistotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -field("milliseconds").unixMillisToTimestamp(); - -``` - A new representing the timestamp. | -| [unixSecondsToTimestamp()](./firestore_pipelines.expression.md#expressionunixsecondstotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'seconds' field as seconds since epoch. -field("seconds").unixSecondsToTimestamp(); - -``` - A new representing the timestamp. | -| [vectorLength()](./firestore_pipelines.expression.md#expressionvectorlength) | | (Public Preview) Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. -```typescript -// Get the vector length (dimension) of the field 'embedding'. -field("embedding").vectorLength(); - -``` - A new representing the length of the vector. | +| [unixMicrosToTimestamp()](./firestore_pipelines.expression.md#expressionunixmicrostotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixMillisToTimestamp()](./firestore_pipelines.expression.md#expressionunixmillistotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixSecondsToTimestamp()](./firestore_pipelines.expression.md#expressionunixsecondstotimestamp) | | (Public Preview) Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [vectorLength()](./firestore_pipelines.expression.md#expressionvectorlength) | | (Public Preview) Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. | ## Expression.expressionType @@ -871,28 +184,53 @@ abstract readonly expressionType: ExpressionType; Creates an expression that computes the absolute value of a numeric value. +Signature: + +```typescript +abs(): FunctionExpression; +``` +Returns: + +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the absolute value of the numeric value. + +### Example + + ```typescript // Compute the absolute value of the 'price' field. field("price").abs(); ``` - A new representing the absolute value of the numeric value. + +## Expression.add() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds this expression to another expression. Signature: ```typescript -abs(): FunctionExpression; +add(second: Expression | unknown): FunctionExpression; ``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The expression or literal to add to this expression. | + Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.add() +A new `Expression` representing the addition operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds this expression to another expression. ```typescript // Add the value of the 'quantity' field and the 'reserve' field. @@ -900,28 +238,34 @@ field("quantity").add(field("reserve")); ``` +## Expression.arrayConcat() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates an array expression with one or more other arrays. + Signature: ```typescript -add(second: Expression | unknown): FunctionExpression; +arrayConcat(secondArray: Expression | unknown[], ...otherArrays: Array): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The expression or literal to add to this expression. | +| secondArray | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\] | Second array expression or array literal to concatenate. | +| otherArrays | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayConcat() +A new `Expression` representing the concatenated array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates an array expression with one or more other arrays. ```typescript // Combine the 'items' array with another array field. @@ -929,29 +273,33 @@ field("items").arrayConcat(field("otherItems")); ``` +## Expression.arrayContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains a specific element. + Signature: ```typescript -arrayConcat(secondArray: Expression | unknown[], ...otherArrays: Array): FunctionExpression; +arrayContains(expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| secondArray | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\] | Second array expression or array literal to concatenate. | -| otherArrays | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. A new Expr representing the concatenated array. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The element to search for in the array. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContains() +A new `Expression` representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains a specific element. ```typescript // Check if the 'sizes' array contains the value from the 'selectedSize' field @@ -959,28 +307,33 @@ field("sizes").arrayContains(field("selectedSize")); ``` +## Expression.arrayContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains a specific value. + Signature: ```typescript -arrayContains(expression: Expression): BooleanExpression; +arrayContains(value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The element to search for in the array. A new Expr representing the 'array\_contains' comparison. | +| value | unknown | The element to search for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContains() +A new `Expression` representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains a specific value. ```typescript // Check if the 'colors' array contains "red" @@ -988,28 +341,33 @@ field("colors").arrayContains("red"); ``` +## Expression.arrayContainsAll() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains all the specified elements. + Signature: ```typescript -arrayContains(value: unknown): BooleanExpression; +arrayContainsAll(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The element to search for in the array. A new Expr representing the 'array\_contains' comparison. | +| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAll() +A new `Expression` representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains all the specified elements. ```typescript // Check if the 'tags' array contains both the value in field "tag1" and the literal value "tag2" @@ -1017,28 +375,33 @@ field("tags").arrayContainsAll([field("tag1"), "tag2"]); ``` +## Expression.arrayContainsAll() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains all the specified elements. + Signature: ```typescript -arrayContainsAll(values: Array): BooleanExpression; +arrayContainsAll(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. A new Expr representing the 'array\_contains\_all' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAll() +A new `Expression` representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains all the specified elements. ```typescript // Check if the 'tags' array contains both of the values from field "tag1" and the literal value "tag2" @@ -1046,28 +409,33 @@ field("tags").arrayContainsAll(array([field("tag1"), "tag2"])); ``` +## Expression.arrayContainsAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains any of the specified elements. + Signature: ```typescript -arrayContainsAll(arrayExpression: Expression): BooleanExpression; +arrayContainsAny(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The elements to check for in the array. A new Expr representing the 'array\_contains\_all' comparison. | +| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAny() +A new `Expression` representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains any of the specified elements. ```typescript // Check if the 'categories' array contains either values from field "cate1" or "cate2" @@ -1075,28 +443,33 @@ field("categories").arrayContainsAny([field("cate1"), field("cate2")]); ``` +## Expression.arrayContainsAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array contains any of the specified elements. + Signature: ```typescript -arrayContainsAny(values: Array): BooleanExpression; +arrayContainsAny(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. A new Expr representing the 'array\_contains\_any' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.arrayContainsAny() +A new `Expression` representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array contains any of the specified elements. ```typescript // Check if the 'groups' array contains either the value from the 'userGroup' field @@ -1105,28 +478,33 @@ field("groups").arrayContainsAny(array([field("userGroup"), "guest"])); ``` +## Expression.arrayGet() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript -arrayContainsAny(arrayExpression: Expression): BooleanExpression; +arrayGet(offset: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The elements to check for in the array. A new Expr representing the 'array\_contains\_any' comparison. | +| offset | number | The index of the element to return. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayGet() +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript // Return the value in the 'tags' field array at index `1`. @@ -1134,28 +512,33 @@ field('tags').arrayGet(1); ``` +## Expression.arrayGet() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript -arrayGet(offset: number): FunctionExpression; +arrayGet(offsetExpr: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| offset | number | The index of the element to return. A new Expr representing the 'arrayGet' operation. | +| offsetExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expression evaluating to the index of the element to return. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayGet() +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and returns the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript // Return the value in the tags field array at index specified by field @@ -1164,90 +547,86 @@ field('tags').arrayGet(field('favoriteTag')); ``` -Signature: +## Expression.arrayLength() -```typescript -arrayGet(offsetExpr: Expression): FunctionExpression; -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -#### Parameters +Creates an expression that calculates the length of an array. -| Parameter | Type | Description | -| --- | --- | --- | -| offsetExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expr evaluating to the index of the element to return. A new Expr representing the 'arrayGet' operation. | +Signature: +```typescript +arrayLength(): FunctionExpression; +``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayLength() +A new `Expression` representing the length of the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of an array. ```typescript // Get the number of items in the 'cart' array field("cart").arrayLength(); ``` - A new `Expr` representing the length of the array. + +## Expression.arrayReverse() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses an array. Signature: ```typescript -arrayLength(): FunctionExpression; +arrayReverse(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.arrayReverse() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses an array. ```typescript // Reverse the value of the 'myArray' field. field("myArray").arrayReverse(); ``` - A new representing the reversed array. + +## Expression.arraySum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the sum of the elements in an array. Signature: ```typescript -arrayReverse(): FunctionExpression; +arraySum(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.arraySum() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the sum of the elements in the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the sum of the elements in an array. ```typescript // Compute the sum of the elements in the 'scores' field. field("scores").arraySum(); ``` - A new representing the sum of the elements in the array. - -Signature: - -```typescript -arraySum(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) ## Expression.as() @@ -1258,13 +637,6 @@ Assigns an alias to this expression. Aliases are useful for renaming fields in the output of a stage or for giving meaningful names to calculated values. -```typescript -// Calculate the total price and assign it the alias "totalPrice" and add it to the output. -firestore.pipeline().collection("items") - .addFields(field("price").multiply(field("quantity")).as("totalPrice")); - -``` - Signature: ```typescript @@ -1275,12 +647,24 @@ as(name: string): AliasedExpression; | Parameter | Type | Description | | --- | --- | --- | -| name | string | The alias to assign to this expression. A new that wraps this expression and associates it with the provided alias. | +| name | string | The alias to assign to this expression. | Returns: [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class) +A new [AliasedExpression](./firestore_pipelines.aliasedexpression.md#aliasedexpression_class) that wraps this expression and associates it with the provided alias. + +### Example + + +```typescript +// Calculate the total price and assign it the alias "totalPrice" and add it to the output. +firestore.pipeline().collection("items") + .addFields(field("price").multiply(field("quantity")).as("totalPrice")); + +``` + ## Expression.asBoolean() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1288,8 +672,6 @@ as(name: string): AliasedExpression; Wraps the expression in a \[BooleanExpression\]. - A \[BooleanExpression\] representing the same expression. - Signature: ```typescript @@ -1299,12 +681,28 @@ asBoolean(): BooleanExpression; [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A \[BooleanExpression\] representing the same expression. + ## Expression.ascending() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an that sorts documents in ascending order based on this expression. +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on this expression. + +Signature: + +```typescript +ascending(): Ordering; +``` +Returns: + +[Ordering](./firestore_pipelines.ordering.md#ordering_class) + +A new `Ordering` for ascending sorting. + +### Example + ```typescript // Sort documents by the 'name' field in ascending order @@ -1312,131 +710,141 @@ pipeline().collection("users") .sort(field("name").ascending()); ``` - A new `Ordering` for ascending sorting. + +## Expression.average() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. Signature: ```typescript -ascending(): Ordering; +average(): AggregateFunction; ``` Returns: -[Ordering](./firestore_pipelines.ordering.md#ordering_class) +[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.average() +A new `AggregateFunction` representing the 'average' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the average (mean) of a numeric field across multiple stage inputs. ```typescript // Calculate the average age of users field("age").average().as("averageAge"); ``` - A new `AggregateFunction` representing the 'average' aggregation. + +## Expression.byteLength() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of this string expression in bytes. Signature: ```typescript -average(): AggregateFunction; +byteLength(): FunctionExpression; ``` Returns: -[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.byteLength() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string in bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of this string expression in bytes. ```typescript // Calculate the length of the 'myString' field in bytes. field("myString").byteLength(); ``` - A new representing the length of the string in bytes. + +## Expression.ceil() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the ceiling of a numeric value. Signature: ```typescript -byteLength(): FunctionExpression; +ceil(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.ceil() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the ceiling of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the ceiling of a numeric value. ```typescript // Compute the ceiling of the 'price' field. field("price").ceil(); ``` - A new representing the ceiling of the numeric value. + +## Expression.charLength() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the character length of a string in UTF-8. Signature: ```typescript -ceil(): FunctionExpression; +charLength(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.charLength() +A new `Expression` representing the length of the string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the character length of a string in UTF-8. ```typescript // Get the character length of the 'name' field in its UTF-8 form. field("name").charLength(); ``` - A new `Expr` representing the length of the string. + +## Expression.collectionId() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the collection ID from a path. Signature: ```typescript -charLength(): FunctionExpression; +collectionId(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.collectionId() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the collectionId operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the collection ID from a path. ```typescript // Get the collection ID from a path. field("__path__").collectionId(); ``` - A new representing the collectionId operation. - -Signature: - -```typescript -collectionId(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) ## Expression.concat() @@ -1445,12 +853,6 @@ collectionId(): FunctionExpression; Creates an expression that concatenates expression results together. -```typescript -// Combine the 'firstName', ' ', and 'lastName' fields into a single value. -field("firstName").concat(constant(" "), field("lastName")); - -``` - Signature: ```typescript @@ -1462,25 +864,30 @@ concat(second: Expression | unknown, ...others: Array): Fu | Parameter | Type | Description | | --- | --- | --- | | second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The additional expression or literal to concatenate. | -| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals to concatenate. A new Expr representing the concatenated value. | +| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.cosineDistance() +A new `Expression` representing the concatenated value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the cosine distance between two vectors. ```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -field("userVector").cosineDistance(field("itemVector")); +// Combine the 'firstName', ' ', and 'lastName' fields into a single value. +field("firstName").concat(constant(" "), field("lastName")); ``` +## Expression.cosineDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the cosine distance between two vectors. + Signature: ```typescript @@ -1491,25 +898,30 @@ cosineDistance(vectorExpression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new Expr representing the cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.cosineDistance() +A new `Expression` representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between two vectors. ```typescript -// Calculate the Cosine distance between the 'location' field and a target location -field("location").cosineDistance(new VectorValue([37.7749, -122.4194])); +// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field +field("userVector").cosineDistance(field("itemVector")); ``` +## Expression.cosineDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between two vectors. + Signature: ```typescript @@ -1520,25 +932,29 @@ cosineDistance(vector: VectorValue | number[]): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| vector | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. A new Expr representing the Cosine\* distance between the two vectors. | +| vector | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.count() +A new `Expression` representing the Cosine\* distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. ```typescript -// Count the total number of products -field("productId").count().as("totalProducts"); +// Calculate the Cosine distance between the 'location' field and a target location +field("location").cosineDistance(new VectorValue([37.7749, -122.4194])); ``` - A new `AggregateFunction` representing the 'count' aggregation. + +## Expression.count() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of stage inputs with valid evaluations of the expression or field. Signature: @@ -1549,19 +965,23 @@ count(): AggregateFunction; [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.countDistinct() +A new `AggregateFunction` representing the 'count' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of distinct values of the expression or field. ```typescript -// Count the distinct number of products -field("productId").countDistinct().as("distinctProducts"); +// Count the total number of products +field("productId").count().as("totalProducts"); ``` - A new `AggregateFunction` representing the 'count\_distinct' aggregation. + +## Expression.countDistinct() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of distinct values of the expression or field. Signature: @@ -1572,20 +992,23 @@ countDistinct(): AggregateFunction; [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.descending() +A new `AggregateFunction` representing the 'count\_distinct' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an that sorts documents in descending order based on this expression. ```typescript -// Sort documents by the 'createdAt' field in descending order -firestore.pipeline().collection("users") - .sort(field("createdAt").descending()); +// Count the distinct number of products +field("productId").countDistinct().as("distinctProducts"); ``` - A new `Ordering` for descending sorting. + +## Expression.descending() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on this expression. Signature: @@ -1596,19 +1019,25 @@ descending(): Ordering; [Ordering](./firestore_pipelines.ordering.md#ordering_class) -## Expression.divide() +A new `Ordering` for descending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides this expression by another expression. ```typescript -// Divide the 'total' field by the 'count' field -field("total").divide(field("count")); +// Sort documents by the 'createdAt' field in descending order +firestore.pipeline().collection("users") + .sort(field("createdAt").descending()); ``` +## Expression.divide() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides this expression by another expression. + Signature: ```typescript @@ -1619,25 +1048,30 @@ divide(divisor: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| divisor | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. A new Expr representing the division operation. | +| divisor | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.divide() +A new `Expression` representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides this expression by a constant value. ```typescript -// Divide the 'value' field by 10 -field("value").divide(10); +// Divide the 'total' field by the 'count' field +field("total").divide(field("count")); ``` +## Expression.divide() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides this expression by a constant value. + Signature: ```typescript @@ -1648,12 +1082,23 @@ divide(divisor: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| divisor | number | The constant value to divide by. A new Expr representing the division operation. | +| divisor | number | The constant value to divide by. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the division operation. + +### Example + + +```typescript +// Divide the 'value' field by 10 +field("value").divide(10); + +``` + ## Expression.documentId() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -1661,28 +1106,53 @@ divide(divisor: number): FunctionExpression; Creates an expression that returns the document ID from a path. +Signature: + +```typescript +documentId(): FunctionExpression; +``` +Returns: + +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the documentId operation. + +### Example + + ```typescript // Get the document ID from a path. field("__path__").documentId(); ``` - A new representing the documentId operation. + +## Expression.dotProduct() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between two vectors. Signature: ```typescript -documentId(): FunctionExpression; +dotProduct(vectorExpression: Expression): FunctionExpression; ``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. | + Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.dotProduct() +A new `Expression` representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between two vectors. ```typescript // Calculate the dot product between a feature vector and a target vector @@ -1690,28 +1160,33 @@ field("features").dotProduct([0.5, 0.8, 0.2]); ``` +## Expression.dotProduct() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between two vectors. + Signature: ```typescript -dotProduct(vectorExpression: Expression): FunctionExpression; +dotProduct(vector: VectorValue | number[]): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. A new Expr representing the dot product between the two vectors. | +| vector | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as an array of numbers) to calculate with. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.dotProduct() +A new `Expression` representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between two vectors. ```typescript // Calculate the dot product between a feature vector and a target vector @@ -1719,28 +1194,33 @@ field("features").dotProduct(new VectorValue([0.5, 0.8, 0.2])); ``` +## Expression.endsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string ends with a given postfix. + Signature: ```typescript -dotProduct(vector: VectorValue | number[]): FunctionExpression; +endsWith(suffix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| vector | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as an array of numbers) to calculate with. A new Expr representing the dot product between the two vectors. | +| suffix | string | The postfix to check for. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.endsWith() +A new `Expression` representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string ends with a given postfix. ```typescript // Check if the 'filename' field ends with ".txt" @@ -1748,28 +1228,33 @@ field("filename").endsWith(".txt"); ``` +## Expression.endsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string ends with a given postfix (represented as an expression). + Signature: ```typescript -endsWith(suffix: string): BooleanExpression; +endsWith(suffix: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| suffix | string | The postfix to check for. A new Expr representing the 'ends with' comparison. | +| suffix | [Expression](./firestore_pipelines.expression.md#expression_class) | The postfix expression to check for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.endsWith() +A new `Expression` representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string ends with a given postfix (represented as an expression). ```typescript // Check if the 'url' field ends with the value of the 'extension' field @@ -1777,28 +1262,33 @@ field("url").endsWith(field("extension")); ``` +## Expression.equal() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to another expression. + Signature: ```typescript -endsWith(suffix: Expression): BooleanExpression; +equal(expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| suffix | [Expression](./firestore_pipelines.expression.md#expression_class) | The postfix expression to check for. A new Expr representing the 'ends with' comparison. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for equality. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equal() +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to another expression. ```typescript // Check if the 'age' field is equal to 21 @@ -1806,28 +1296,33 @@ field("age").equal(21); ``` +## Expression.equal() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to a constant value. + Signature: ```typescript -equal(expression: Expression): BooleanExpression; +equal(value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for equality. A new Expr representing the equality comparison. | +| value | unknown | The constant value to compare for equality. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equal() +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to a constant value. ```typescript // Check if the 'city' field is equal to "London" @@ -1835,28 +1330,33 @@ field("city").equal("London"); ``` +## Expression.equalAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to any of the provided values or expressions. + Signature: ```typescript -equal(value: unknown): BooleanExpression; +equalAny(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for equality. A new Expr representing the equality comparison. | +| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equalAny() +A new `Expression` representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -1864,28 +1364,33 @@ field("category").equalAny("Electronics", field("primaryType")); ``` +## Expression.equalAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is equal to any of the provided values or expressions. + Signature: ```typescript -equalAny(values: Array): BooleanExpression; +equalAny(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. A new Expr representing the 'IN' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array of values to check against. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.equalAny() +A new `Expression` representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -1893,28 +1398,33 @@ field("category").equalAny(array(["Electronics", field("primaryType")])); ``` +## Expression.euclideanDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between two vectors. + Signature: ```typescript -equalAny(arrayExpression: Expression): BooleanExpression; +euclideanDistance(vectorExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array of values to check against. A new Expr representing the 'IN' comparison. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.euclideanDistance() +A new `Expression` representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between two vectors. ```typescript // Calculate the Euclidean distance between the 'location' field and a target location @@ -1922,28 +1432,33 @@ field("location").euclideanDistance([37.7749, -122.4194]); ``` +## Expression.euclideanDistance() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between two vectors. + Signature: ```typescript -euclideanDistance(vectorExpression: Expression): FunctionExpression; +euclideanDistance(vector: VectorValue | number[]): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (as an array of numbers) to calculate with. A new Expr representing the Euclidean distance between the two vectors. | +| vector | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.euclideanDistance() +A new `Expression` representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between two vectors. ```typescript // Calculate the Euclidean distance between the 'location' field and a target location @@ -1951,90 +1466,86 @@ field("location").euclideanDistance(new VectorValue([37.7749, -122.4194])); ``` -Signature: +## Expression.exists() -```typescript -euclideanDistance(vector: VectorValue | number[]): FunctionExpression; -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -#### Parameters +Creates an expression that checks if a field exists in the document. -| Parameter | Type | Description | -| --- | --- | --- | -| vector | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) \| number\[\] | The other vector (as a VectorValue) to compare against. A new Expr representing the Euclidean distance between the two vectors. | +Signature: +```typescript +exists(): BooleanExpression; +``` Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.exists() +A new `Expression` representing the 'exists' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field exists in the document. ```typescript // Check if the document has a field named "phoneNumber" field("phoneNumber").exists(); ``` - A new `Expr` representing the 'exists' check. + +## Expression.exp() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes e to the power of this expression. Signature: ```typescript -exists(): BooleanExpression; +exp(): FunctionExpression; ``` Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.exp() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the exp of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes e to the power of this expression. ```typescript // Compute e to the power of the 'value' field. field("value").exp(); ``` - A new representing the exp of the numeric value. + +## Expression.floor() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the floor of a numeric value. Signature: ```typescript -exp(): FunctionExpression; +floor(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.floor() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the floor of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the floor of a numeric value. ```typescript // Compute the floor of the 'price' field. field("price").floor(); ``` - A new representing the floor of the numeric value. - -Signature: - -```typescript -floor(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) ## Expression.greaterThan() @@ -2043,12 +1554,6 @@ floor(): FunctionExpression; Creates an expression that checks if this expression is greater than another expression. -```typescript -// Check if the 'age' field is greater than the 'limit' field -field("age").greaterThan(field("limit")); - -``` - Signature: ```typescript @@ -2059,25 +1564,30 @@ greaterThan(expression: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for greater than. A new Expr representing the greater than comparison. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for greater than. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.greaterThan() +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is greater than a constant value. ```typescript -// Check if the 'price' field is greater than 100 -field("price").greaterThan(100); +// Check if the 'age' field is greater than the 'limit' field +field("age").greaterThan(field("limit")); ``` +## Expression.greaterThan() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is greater than a constant value. + Signature: ```typescript @@ -2088,25 +1598,30 @@ greaterThan(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for greater than. A new Expr representing the greater than comparison. | +| value | unknown | The constant value to compare for greater than. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.greaterThanOrEqual() +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is greater than or equal to another expression. ```typescript -// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1 -field("quantity").greaterThanOrEqual(field('requirement').add(1)); +// Check if the 'price' field is greater than 100 +field("price").greaterThan(100); ``` +## Expression.greaterThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is greater than or equal to another expression. + Signature: ```typescript @@ -2117,25 +1632,30 @@ greaterThanOrEqual(expression: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for greater than or equal to. A new Expr representing the greater than or equal to comparison. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for greater than or equal to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.greaterThanOrEqual() +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is greater than or equal to a constant value. ```typescript -// Check if the 'score' field is greater than or equal to 80 -field("score").greaterThanOrEqual(80); +// Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1 +field("quantity").greaterThanOrEqual(field('requirement').add(1)); ``` +## Expression.greaterThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is greater than or equal to a constant value. + Signature: ```typescript @@ -2146,26 +1666,30 @@ greaterThanOrEqual(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for greater than or equal to. A new Expr representing the greater than or equal to comparison. | +| value | unknown | The constant value to compare for greater than or equal to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.ifAbsent() +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `elseValue` argument if this expression results in an absent value, else return the result of the this expression evaluation. ```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -field("optional_field").ifAbsent("default_value") +// Check if the 'score' field is greater than or equal to 80 +field("score").greaterThanOrEqual(80); ``` +## Expression.ifAbsent() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `elseValue` argument if this expression results in an absent value, else return the result of the this expression evaluation. + Signature: ```typescript @@ -2176,12 +1700,24 @@ ifAbsent(elseValue: unknown): Expression; | Parameter | Type | Description | | --- | --- | --- | -| elseValue | unknown | The value that will be returned if this Expression evaluates to an absent value. A new \[Expression\] representing the ifAbsent operation. | +| elseValue | unknown | The value that will be returned if this Expression evaluates to an absent value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new \[Expression\] representing the ifAbsent operation. + +### Example + + +```typescript +// Returns the value of the optional field 'optional_field', or returns 'default_value' +// if the field is absent. +field("optional_field").ifAbsent("default_value") + +``` + ## Expression.ifAbsent() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2206,12 +1742,14 @@ ifAbsent(elseExpression: unknown): Expression; | Parameter | Type | Description | | --- | --- | --- | -| elseExpression | unknown | The Expression that will be evaluated if this Expression evaluates to an absent value. A new \[Expression\] representing the ifAbsent operation. | +| elseExpression | unknown | The Expression that will be evaluated if this Expression evaluates to an absent value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new \[Expression\] representing the ifAbsent operation. + ## Expression.ifError() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2219,13 +1757,6 @@ ifAbsent(elseExpression: unknown): Expression; Creates an expression that returns the result of the `catchExpr` argument if there is an error, else return the result of this expression. -```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -field("title").arrayGet(0).ifError(field("title")); - -``` - Signature: ```typescript @@ -2236,25 +1767,30 @@ ifError(catchExpr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.ifError() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. ```typescript // Returns the first item in the title field arrays, or returns -// "Default Title" -field("title").arrayGet(0).ifError("Default Title"); +// the entire title field if the array is empty or the field is another type. +field("title").arrayGet(0).ifError(field("title")); + +``` + +## Expression.ifError() -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of this expression. Signature: @@ -2266,25 +1802,30 @@ ifError(catchValue: unknown): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| catchValue | unknown | The value that will be returned if this expression produces an error. A new representing the 'ifError' operation. | +| catchValue | unknown | The value that will be returned if this expression produces an error. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.isAbsent() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns `true` if the result of this expression is absent. Otherwise, returns `false` even if the value is `null`. ```typescript -// Check if the field `value` is absent. -field("value").isAbsent(); +// Returns the first item in the title field arrays, or returns +// "Default Title" +field("title").arrayGet(0).ifError("Default Title"); ``` - A new representing the 'isAbsent' check. + +## Expression.isAbsent() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns `true` if the result of this expression is absent. Otherwise, returns `false` even if the value is `null`. Signature: @@ -2295,19 +1836,24 @@ isAbsent(): BooleanExpression; [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.isError() +A new [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) representing the 'isAbsent' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a given expression produces an error. ```typescript -// Check if the result of a calculation is an error -field("title").arrayContains(1).isError(); +// Check if the field `value` is absent. +field("value").isAbsent(); +@example ``` - A new representing the 'isError' check. + +## Expression.isError() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a given expression produces an error. Signature: @@ -2318,19 +1864,24 @@ isError(): BooleanExpression; [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.join() +A new [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) representing the 'isError' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -field("tags").join(field("separator")) +// Check if the result of a calculation is an error +field("title").arrayContains(1).isError(); ``` +## Expression.join() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array into a string. + Signature: ```typescript @@ -2341,25 +1892,30 @@ join(delimiterExpression: Expression): Expression; | Parameter | Type | Description | | --- | --- | --- | -| delimiterExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. A new Expression representing the join operation. | +| delimiterExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) -## Expression.join() +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array field into a string. ```typescript -// Join the elements of the 'tags' field with a comma and space. -field("tags").join(", ") +// Join the elements of the 'tags' field with the delimiter from the 'separator' field. +field("tags").join(field("separator")) ``` +## Expression.join() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array field into a string. + Signature: ```typescript @@ -2370,28 +1926,29 @@ join(delimiter: string): Expression; | Parameter | Type | Description | | --- | --- | --- | -| delimiter | string | The string to use as a delimiter. A new Expression representing the join operation. | +| delimiter | string | The string to use as a delimiter. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) -## Expression.length() +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string, array, map, vector, or bytes. ```typescript -// Get the length of the 'name' field. -field("name").length(); - -// Get the number of items in the 'cart' array. -field("cart").length(); +// Join the elements of the 'tags' field with a comma and space. +field("tags").join(", ") ``` - A new `Expr` representing the length of the string, array, map, vector, or bytes. + +## Expression.length() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string, array, map, vector, or bytes. Signature: @@ -2402,19 +1959,27 @@ length(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.lessThan() +A new `Expression` representing the length of the string, array, map, vector, or bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than another expression. ```typescript -// Check if the 'age' field is less than 'limit' -field("age").lessThan(field('limit')); +// Get the length of the 'name' field. +field("name").length(); + +// Get the number of items in the 'cart' array. +field("cart").length(); ``` +## Expression.lessThan() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than another expression. + Signature: ```typescript @@ -2425,25 +1990,30 @@ lessThan(experession: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| experession | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for less than. A new Expr representing the less than comparison. | +| experession | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for less than. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.lessThan() +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than a constant value. ```typescript -// Check if the 'price' field is less than 50 -field("price").lessThan(50); +// Check if the 'age' field is less than 'limit' +field("age").lessThan(field('limit')); ``` +## Expression.lessThan() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than a constant value. + Signature: ```typescript @@ -2454,25 +2024,30 @@ lessThan(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for less than. A new Expr representing the less than comparison. | +| value | unknown | The constant value to compare for less than. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.lessThanOrEqual() +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than or equal to another expression. ```typescript -// Check if the 'quantity' field is less than or equal to 20 -field("quantity").lessThan(constant(20)); +// Check if the 'price' field is less than 50 +field("price").lessThan(50); ``` +## Expression.lessThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than or equal to another expression. + Signature: ```typescript @@ -2483,25 +2058,30 @@ lessThanOrEqual(expression: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for less than or equal to. A new Expr representing the less than or equal to comparison. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for less than or equal to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.lessThanOrEqual() +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is less than or equal to a constant value. ```typescript -// Check if the 'score' field is less than or equal to 70 -field("score").lessThan(70); +// Check if the 'quantity' field is less than or equal to 20 +field("quantity").lessThan(constant(20)); ``` +## Expression.lessThanOrEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is less than or equal to a constant value. + Signature: ```typescript @@ -2512,25 +2092,30 @@ lessThanOrEqual(value: unknown): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for less than or equal to. A new Expr representing the less than or equal to comparison. | +| value | unknown | The constant value to compare for less than or equal to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.like() +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive string comparison. ```typescript -// Check if the 'title' field contains the word "guide" (case-sensitive) -field("title").like("%guide%"); +// Check if the 'score' field is less than or equal to 70 +field("score").lessThan(70); ``` +## Expression.like() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive string comparison. + Signature: ```typescript @@ -2541,18 +2126,16 @@ like(pattern: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| pattern | string | The pattern to search for. You can use "%" as a wildcard character. A new Expr representing the 'like' comparison. | +| pattern | string | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.like() +A new `Expression` representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive string comparison. ```typescript // Check if the 'title' field contains the word "guide" (case-sensitive) @@ -2560,6 +2143,13 @@ field("title").like("%guide%"); ``` +## Expression.like() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive string comparison. + Signature: ```typescript @@ -2570,25 +2160,29 @@ like(pattern: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. A new Expr representing the 'like' comparison. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.ln() +A new `Expression` representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the natural logarithm of a numeric value. ```typescript -// Compute the natural logarithm of the 'value' field. -field("value").ln(); +// Check if the 'title' field contains the word "guide" (case-sensitive) +field("title").like("%guide%"); ``` - A new representing the natural logarithm of the numeric value. + +## Expression.ln() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the natural logarithm of a numeric value. Signature: @@ -2599,19 +2193,23 @@ ln(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.log10() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the natural logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the base-10 logarithm of a numeric value. ```typescript -// Compute the base-10 logarithm of the 'value' field. -field("value").log10(); +// Compute the natural logarithm of the 'value' field. +field("value").ln(); ``` - A new representing the base-10 logarithm of the numeric value. + +## Expression.log10() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the base-10 logarithm of a numeric value. Signature: @@ -2622,19 +2220,24 @@ log10(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.logicalMaximum() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the base-10 logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. ```typescript -// Returns the larger value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMaximum(Function.currentTimestamp()); +// Compute the base-10 logarithm of the 'value' field. +field("value").log10(); ``` +## Expression.logicalMaximum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. + Signature: ```typescript @@ -2646,25 +2249,30 @@ logicalMaximum(second: Expression | unknown, ...others: ArrayReturns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.logicalMinimum() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical maximum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. ```typescript -// Returns the smaller value between the 'timestamp' field and the current timestamp. -field("timestamp").logicalMinimum(Function.currentTimestamp()); +// Returns the larger value between the 'timestamp' field and the current timestamp. +field("timestamp").logicalMaximum(Function.currentTimestamp()); ``` +## Expression.logicalMinimum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. + Signature: ```typescript @@ -2676,11 +2284,22 @@ logicalMinimum(second: Expression | unknown, ...others: ArrayReturns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical minimum operation. + +### Example + + +```typescript +// Returns the smaller value between the 'timestamp' field and the current timestamp. +field("timestamp").logicalMinimum(Function.currentTimestamp()); + +``` ## Expression.mapGet() @@ -2689,12 +2308,6 @@ logicalMinimum(second: Expression | unknown, ...others: ArraySignature: ```typescript @@ -2705,12 +2318,23 @@ mapGet(subfield: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| subfield | string | The key to access in the map. A new Expr representing the value associated with the given key in the map. | +| subfield | string | The key to access in the map. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the value associated with the given key in the map. + +### Example + + +```typescript +// Get the 'city' value from the 'address' map field +field("address").mapGet("city"); + +``` + ## Expression.mapMerge() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2718,13 +2342,6 @@ mapGet(subfield: string): FunctionExpression; Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -field('settings').mapMerge({ enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - Signature: ```typescript @@ -2742,7 +2359,17 @@ mapMerge(secondMap: Record | Expression, ...otherMaps: ArraySignature: ```typescript @@ -2773,21 +2394,24 @@ mapRemove(key: string): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -A new representing the 'mapRemove' operation. - -## Expression.mapRemove() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'mapRemove' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes a key from the map produced by evaluating this expression. ``` // Removes the key 'baz' from the input map. -map({foo: 'bar', baz: true}).mapRemove(constant('baz')); +map({foo: 'bar', baz: true}).mapRemove('baz'); ``` +## Expression.mapRemove() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes a key from the map produced by evaluating this expression. + Signature: ```typescript @@ -2804,7 +2428,17 @@ mapRemove(keyExpr: Expression): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -A new representing the 'mapRemove' operation. +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'mapRemove' operation. + +### Example + + +``` +// Removes the key 'baz' from the input map. +map({foo: 'bar', baz: true}).mapRemove(constant('baz')); +@example + +``` ## Expression.maximum() @@ -2813,51 +2447,80 @@ A new representing the 'mapRemove' operation. Creates an aggregation that finds the maximum value of a field across multiple stage inputs. +Signature: + +```typescript +maximum(): AggregateFunction; +``` +Returns: + +[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) + +A new `AggregateFunction` representing the 'maximum' aggregation. + +### Example + + ```typescript // Find the highest score in a leaderboard field("score").maximum().as("highestScore"); ``` - A new `AggregateFunction` representing the 'maximum' aggregation. + +## Expression.minimum() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the minimum value of a field across multiple stage inputs. Signature: ```typescript -maximum(): AggregateFunction; +minimum(): AggregateFunction; ``` Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.minimum() +A new `AggregateFunction` representing the 'minimum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the minimum value of a field across multiple stage inputs. ```typescript // Find the lowest price of all products field("price").minimum().as("lowestPrice"); ``` - A new `AggregateFunction` representing the 'minimum' aggregation. + +## Expression.mod() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. Signature: ```typescript -minimum(): AggregateFunction; +mod(expression: Expression): FunctionExpression; ``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. | + Returns: -[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.mod() +A new `Expression` representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. ```typescript // Calculate the remainder of dividing the 'value' field by the 'divisor' field @@ -2865,28 +2528,33 @@ field("value").mod(field("divisor")); ``` +## Expression.mod() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. + Signature: ```typescript -mod(expression: Expression): FunctionExpression; +mod(value: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. A new Expr representing the modulo operation. | +| value | number | The constant value to divide by. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.mod() +A new `Expression` representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. ```typescript // Calculate the remainder of dividing the 'value' field by 10 @@ -2894,28 +2562,33 @@ field("value").mod(10); ``` +## Expression.multiply() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that multiplies this expression by another expression. + Signature: ```typescript -mod(value: number): FunctionExpression; +multiply(second: Expression | number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | number | The constant value to divide by. A new Expr representing the modulo operation. | +| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| number | The second expression or literal to multiply by. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.multiply() +A new `Expression` representing the multiplication operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that multiplies this expression by another expression. ```typescript // Multiply the 'quantity' field by the 'price' field @@ -2923,28 +2596,33 @@ field("quantity").multiply(field("price")); ``` +## Expression.notEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to another expression. + Signature: ```typescript -multiply(second: Expression | number): FunctionExpression; +notEqual(expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| number | The second expression or literal to multiply by. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for inequality. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqual() +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to another expression. ```typescript // Check if the 'status' field is not equal to "completed" @@ -2952,28 +2630,33 @@ field("status").notEqual("completed"); ``` +## Expression.notEqual() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to a constant value. + Signature: ```typescript -notEqual(expression: Expression): BooleanExpression; +notEqual(value: unknown): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare for inequality. A new Expr representing the inequality comparison. | +| value | unknown | The constant value to compare for inequality. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqual() +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to a constant value. ```typescript // Check if the 'country' field is not equal to "USA" @@ -2981,28 +2664,33 @@ field("country").notEqual("USA"); ``` +## Expression.notEqualAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to any of the provided values or expressions. + Signature: ```typescript -notEqual(value: unknown): BooleanExpression; +notEqualAny(values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| value | unknown | The constant value to compare for inequality. A new Expr representing the inequality comparison. | +| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqualAny() +A new `Expression` representing the 'notEqualAny' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to any of the provided values or expressions. ```typescript // Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' @@ -3010,28 +2698,33 @@ field("status").notEqualAny(["pending", field("rejectedStatus")]); ``` +## Expression.notEqualAny() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. + Signature: ```typescript -notEqualAny(values: Array): BooleanExpression; +notEqualAny(arrayExpression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The values or expressions to check against. A new Expr representing the 'notEqualAny' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The values or expressions to check against. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.notEqualAny() +A new `Expression` representing the 'notEqualAny' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. ```typescript // Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' @@ -3039,28 +2732,33 @@ field("status").notEqualAny(field('rejectedStatuses')); ``` +## Expression.pow() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of this expression raised to the power of another expression. + Signature: ```typescript -notEqualAny(arrayExpression: Expression): BooleanExpression; +pow(exponent: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The values or expressions to check against. A new Expr representing the 'notEqualAny' comparison. | +| exponent | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise this expression to the power of. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.pow() +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of this expression raised to the power of another expression. ```typescript // Raise the value of the 'base' field to the power of the 'exponent' field. @@ -3068,28 +2766,33 @@ field("base").pow(field("exponent")); ``` +## Expression.pow() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of this expression raised to the power of a constant value. + Signature: ```typescript -pow(exponent: Expression): FunctionExpression; +pow(exponent: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| exponent | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise this expression to the power of. A new Expr representing the power operation. | +| exponent | number | The constant value to raise this expression to the power of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.pow() +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of this expression raised to the power of a constant value. ```typescript // Raise the value of the 'base' field to the power of 2. @@ -3097,57 +2800,67 @@ field("base").pow(2); ``` +## Expression.regexContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains a specified regular expression as a substring. + Signature: ```typescript -pow(exponent: number): FunctionExpression; +regexContains(pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| exponent | number | The constant value to raise this expression to the power of. A new Expr representing the power operation. | +| pattern | string | The regular expression to use for the search. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexContains() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) field("description").regexContains("(?i)example"); -``` +``` + +## Expression.regexContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains a specified regular expression as a substring. Signature: ```typescript -regexContains(pattern: string): BooleanExpression; +regexContains(pattern: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pattern | string | The regular expression to use for the search. A new Expr representing the 'contains' comparison. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexContains() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains the regular expression stored in field 'regex' @@ -3155,28 +2868,33 @@ field("description").regexContains(field("regex")); ``` +## Expression.regexMatch() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string matches a specified regular expression. + Signature: ```typescript -regexContains(pattern: Expression): BooleanExpression; +regexMatch(pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the search. A new Expr representing the 'contains' comparison. | +| pattern | string | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexMatch() +A new `Expression` representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -3184,28 +2902,33 @@ field("email").regexMatch("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); ``` +## Expression.regexMatch() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string matches a specified regular expression. + Signature: ```typescript -regexMatch(pattern: string): BooleanExpression; +regexMatch(pattern: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pattern | string | The regular expression to use for the match. A new Expr representing the regular expression match. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.regexMatch() +A new `Expression` representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string matches a specified regular expression. ```typescript // Check if the 'email' field matches a regular expression stored in field 'regex' @@ -3213,67 +2936,59 @@ field("email").regexMatch(field("regex")); ``` -Signature: +## Expression.reverse() -```typescript -regexMatch(pattern: Expression): BooleanExpression; -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -#### Parameters +Creates an expression that reverses this string expression. -| Parameter | Type | Description | -| --- | --- | --- | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the match. A new Expr representing the regular expression match. | +Signature: +```typescript +reverse(): FunctionExpression; +``` Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.reverse() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses this string expression. ```typescript // Reverse the value of the 'myString' field. field("myString").reverse(); ``` - A new representing the reversed string. + +## Expression.round() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the nearest whole number. Signature: ```typescript -reverse(): FunctionExpression; +round(): FunctionExpression; ``` Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.round() +A new `Expression` representing the rounded value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the nearest whole number. ```typescript // Round the value of the 'price' field. field("price").round(); ``` - A new `Expr` representing the rounded value. - -Signature: - -```typescript -round(): FunctionExpression; -``` -Returns: - -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) ## Expression.round() @@ -3282,12 +2997,6 @@ round(): FunctionExpression; Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -field("price").round(2); - -``` - Signature: ```typescript @@ -3298,25 +3007,30 @@ round(decimalPlaces: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| decimalPlaces | number | A constant specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | number | A constant specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.round() +A new `Expression` representing the rounded value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the specified number of decimal places. ```typescript // Round the value of the 'price' field to two decimal places. -field("price").round(constant(2)); +field("price").round(2); ``` +## Expression.round() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the specified number of decimal places. + Signature: ```typescript @@ -3327,12 +3041,23 @@ round(decimalPlaces: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| decimalPlaces | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the rounded value. + +### Example + + +```typescript +// Round the value of the 'price' field to two decimal places. +field("price").round(constant(2)); + +``` + ## Expression.split() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3356,6 +3081,8 @@ split(delimiter: string): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3364,7 +3091,6 @@ split(delimiter: string): FunctionExpression; field('scoresCsv').split(',') ``` - A new representing the split function. ## Expression.split() @@ -3389,6 +3115,8 @@ split(delimiter: Expression): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3397,7 +3125,6 @@ split(delimiter: Expression): FunctionExpression; field('scores').split(conditional(field('format').equal('csv'), constant(','), constant(':')) ``` - A new representing the split function. ## Expression.sqrt() @@ -3406,13 +3133,6 @@ field('scores').split(conditional(field('format').equal('csv'), constant(','), c Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -field("value").sqrt(); - -``` - A new representing the square root of the numeric value. - Signature: ```typescript @@ -3422,19 +3142,24 @@ sqrt(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.startsWith() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the square root of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string starts with a given prefix. ```typescript -// Check if the 'name' field starts with "Mr." -field("name").startsWith("Mr."); +// Compute the square root of the 'value' field. +field("value").sqrt(); ``` +## Expression.startsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string starts with a given prefix. + Signature: ```typescript @@ -3445,25 +3170,30 @@ startsWith(prefix: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| prefix | string | The prefix to check for. A new Expr representing the 'starts with' comparison. | +| prefix | string | The prefix to check for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.startsWith() +A new `Expression` representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string starts with a given prefix (represented as an expression). ```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -field("fullName").startsWith(field("firstName")); +// Check if the 'name' field starts with "Mr." +field("name").startsWith("Mr."); ``` +## Expression.startsWith() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string starts with a given prefix (represented as an expression). + Signature: ```typescript @@ -3474,25 +3204,30 @@ startsWith(prefix: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| prefix | [Expression](./firestore_pipelines.expression.md#expression_class) | The prefix expression to check for. A new Expr representing the 'starts with' comparison. | +| prefix | [Expression](./firestore_pipelines.expression.md#expression_class) | The prefix expression to check for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.stringConcat() +A new `Expression` representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates string expressions together. ```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -field("firstName").stringConcat(constant(" "), field("lastName")); +// Check if the 'fullName' field starts with the value of the 'firstName' field +field("fullName").startsWith(field("firstName")); ``` +## Expression.stringConcat() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates string expressions together. + Signature: ```typescript @@ -3504,25 +3239,30 @@ stringConcat(secondString: Expression | string, ...otherStrings: ArrayExpr representing the concatenated string. | +| otherStrings | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or string literals to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.stringContains() +A new `Expression` representing the concatenated string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains a specified substring. ```typescript -// Check if the 'description' field contains "example". -field("description").stringContains("example"); +// Combine the 'firstName', " ", and 'lastName' fields into a single string +field("firstName").stringConcat(constant(" "), field("lastName")); ``` +## Expression.stringContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains a specified substring. + Signature: ```typescript @@ -3533,25 +3273,30 @@ stringContains(substring: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| substring | string | The substring to search for. A new Expr representing the 'contains' comparison. | +| substring | string | The substring to search for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.stringContains() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string contains the string represented by another expression. ```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -field("description").stringContains(field("keyword")); +// Check if the 'description' field contains "example". +field("description").stringContains("example"); ``` +## Expression.stringContains() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string contains the string represented by another expression. + Signature: ```typescript @@ -3562,25 +3307,29 @@ stringContains(expr: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the substring to search for. A new Expr representing the 'contains' comparison. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the substring to search for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -## Expression.stringReverse() +A new `Expression` representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string. ```typescript -// Reverse the value of the 'myString' field. -field("myString").stringReverse(); +// Check if the 'description' field contains the value of the 'keyword' field. +field("description").stringContains(field("keyword")); ``` - A new representing the reversed string. + +## Expression.stringReverse() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string. Signature: @@ -3591,6 +3340,17 @@ stringReverse(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. + +### Example + + +```typescript +// Reverse the value of the 'myString' field. +field("myString").stringReverse(); + +``` + ## Expression.substring() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3646,12 +3406,6 @@ substring(position: Expression, length?: Expression): FunctionExpression; Creates an expression that subtracts another expression from this expression. -```typescript -// Subtract the 'discount' field from the 'price' field -field("price").subtract(field("discount")); - -``` - Signature: ```typescript @@ -3662,25 +3416,30 @@ subtract(subtrahend: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| subtrahend | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract from this expression. A new Expr representing the subtraction operation. | +| subtrahend | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract from this expression. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.subtract() +A new `Expression` representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a constant value from this expression. ```typescript -// Subtract 20 from the value of the 'total' field -field("total").subtract(20); +// Subtract the 'discount' field from the 'price' field +field("price").subtract(field("discount")); ``` +## Expression.subtract() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a constant value from this expression. + Signature: ```typescript @@ -3691,11 +3450,22 @@ subtract(subtrahend: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| subtrahend | number | The constant value to subtract. A new Expr representing the subtraction operation. | +| subtrahend | number | The constant value to subtract. | + +Returns: + +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new `Expression` representing the subtraction operation. + +### Example -Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +```typescript +// Subtract 20 from the value of the 'total' field +field("total").subtract(20); + +``` ## Expression.sum() @@ -3704,13 +3474,6 @@ subtract(subtrahend: number): FunctionExpression; Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -field("orderAmount").sum().as("totalRevenue"); - -``` - A new `AggregateFunction` representing the 'sum' aggregation. - Signature: ```typescript @@ -3720,19 +3483,24 @@ sum(): AggregateFunction; [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -## Expression.timestampAdd() +A new `AggregateFunction` representing the 'sum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to this timestamp expression. ```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -field("timestamp").timestampAdd(field("unit"), field("amount")); +// Calculate the total revenue from a set of orders +field("orderAmount").sum().as("totalRevenue"); ``` +## Expression.timestampAdd() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to this timestamp expression. + Signature: ```typescript @@ -3744,25 +3512,30 @@ timestampAdd(unit: Expression, amount: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | unit | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampAdd() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to this timestamp expression. ```typescript -// Add 1 day to the 'timestamp' field. -field("timestamp").timestampAdd("day", 1); +// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. +field("timestamp").timestampAdd(field("unit"), field("amount")); ``` +## Expression.timestampAdd() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to this timestamp expression. + Signature: ```typescript @@ -3774,25 +3547,30 @@ timestampAdd(unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | Parameter | Type | Description | | --- | --- | --- | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to add (e.g., "day", "hour"). | -| amount | number | The amount of time to add. A new representing the resulting timestamp. | +| amount | number | The amount of time to add. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampSubtract() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from this timestamp expression. ```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -field("timestamp").timestampSubtract(field("unit"), field("amount")); +// Add 1 day to the 'timestamp' field. +field("timestamp").timestampAdd("day", 1); ``` +## Expression.timestampSubtract() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from this timestamp expression. + Signature: ```typescript @@ -3804,25 +3582,30 @@ timestampSubtract(unit: Expression, amount: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | unit | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampSubtract() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from this timestamp expression. ```typescript -// Subtract 1 day from the 'timestamp' field. -field("timestamp").timestampSubtract("day", 1); +// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. +field("timestamp").timestampSubtract(field("unit"), field("amount")); ``` +## Expression.timestampSubtract() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from this timestamp expression. + Signature: ```typescript @@ -3834,25 +3617,29 @@ timestampSubtract(unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'h | Parameter | Type | Description | | --- | --- | --- | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to subtract (e.g., "day", "hour"). | -| amount | number | The amount of time to subtract. A new representing the resulting timestamp. | +| amount | number | The amount of time to subtract. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampToUnixMicros() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to microseconds since epoch. -field("timestamp").timestampToUnixMicros(); +// Subtract 1 day from the 'timestamp' field. +field("timestamp").timestampSubtract("day", 1); ``` - A new representing the number of microseconds since epoch. + +## Expression.timestampToUnixMicros() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). Signature: @@ -3863,19 +3650,23 @@ timestampToUnixMicros(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampToUnixMillis() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of microseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -field("timestamp").timestampToUnixMillis(); +// Convert the 'timestamp' field to microseconds since epoch. +field("timestamp").timestampToUnixMicros(); ``` - A new representing the number of milliseconds since epoch. + +## Expression.timestampToUnixMillis() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). Signature: @@ -3886,19 +3677,23 @@ timestampToUnixMillis(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.timestampToUnixSeconds() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of milliseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to seconds since epoch. -field("timestamp").timestampToUnixSeconds(); +// Convert the 'timestamp' field to milliseconds since epoch. +field("timestamp").timestampToUnixMillis(); ``` - A new representing the number of seconds since epoch. + +## Expression.timestampToUnixSeconds() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). Signature: @@ -3909,6 +3704,17 @@ timestampToUnixSeconds(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of seconds since epoch. + +### Example + + +```typescript +// Convert the 'timestamp' field to seconds since epoch. +field("timestamp").timestampToUnixSeconds(); + +``` + ## Expression.timestampTruncate() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3927,12 +3733,14 @@ timestampTruncate(granularity: TimeGranularity, timezone?: string | Expression): | Parameter | Type | Description | | --- | --- | --- | | granularity | [TimeGranularity](./firestore_pipelines.md#timegranularity) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -3960,12 +3768,14 @@ timestampTruncate(granularity: Expression, timezone?: string | Expression): Func | Parameter | Type | Description | | --- | --- | --- | | granularity | [Expression](./firestore_pipelines.expression.md#expression_class) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -3982,13 +3792,6 @@ field('createdAt').timestampTruncate(field('granularity')) Creates an expression that converts a string to lowercase. -```typescript -// Convert the 'name' field to lowercase -field("name").toLower(); - -``` - A new `Expr` representing the lowercase string. - Signature: ```typescript @@ -3998,19 +3801,23 @@ toLower(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.toUpper() +A new `Expression` representing the lowercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string to uppercase. ```typescript -// Convert the 'title' field to uppercase -field("title").toUpper(); +// Convert the 'name' field to lowercase +field("name").toLower(); ``` - A new `Expr` representing the uppercase string. + +## Expression.toUpper() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string to uppercase. Signature: @@ -4021,22 +3828,24 @@ toUpper(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.trim() +A new `Expression` representing the uppercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes leading and trailing characters from a string or byte array. ```typescript -// Trim whitespace from the 'userInput' field -field("userInput").trim(); - -// Trim quotes from the 'userInput' field -field("userInput").trim('"'); +// Convert the 'title' field to uppercase +field("title").toUpper(); ``` +## Expression.trim() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes leading and trailing characters from a string or byte array. + Signature: ```typescript @@ -4047,12 +3856,26 @@ trim(valueToTrim?: string | Expression | Bytes): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| valueToTrim | string \| [Expression](./firestore_pipelines.expression.md#expression_class) \| [Bytes](./firestore_.bytes.md#bytes_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. A new Expr representing the trimmed string or byte array. | +| valueToTrim | string \| [Expression](./firestore_pipelines.expression.md#expression_class) \| [Bytes](./firestore_.bytes.md#bytes_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the trimmed string or byte array. + +### Example + + +```typescript +// Trim whitespace from the 'userInput' field +field("userInput").trim(); + +// Trim quotes from the 'userInput' field +field("userInput").trim('"'); + +``` + ## Expression.type() > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -4069,6 +3892,8 @@ type(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the data type. + ### Example @@ -4077,7 +3902,6 @@ type(): FunctionExpression; field('title').type() ``` - A new {Expression} representing the data type. ## Expression.unixMicrosToTimestamp() @@ -4086,13 +3910,6 @@ field('title').type() Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -field("microseconds").unixMicrosToTimestamp(); - -``` - A new representing the timestamp. - Signature: ```typescript @@ -4102,19 +3919,23 @@ unixMicrosToTimestamp(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.unixMillisToTimestamp() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -field("milliseconds").unixMillisToTimestamp(); +// Interpret the 'microseconds' field as microseconds since epoch. +field("microseconds").unixMicrosToTimestamp(); ``` - A new representing the timestamp. + +## Expression.unixMillisToTimestamp() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. Signature: @@ -4125,19 +3946,23 @@ unixMillisToTimestamp(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.unixSecondsToTimestamp() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'seconds' field as seconds since epoch. -field("seconds").unixSecondsToTimestamp(); +// Interpret the 'milliseconds' field as milliseconds since epoch. +field("milliseconds").unixMillisToTimestamp(); ``` - A new representing the timestamp. + +## Expression.unixSecondsToTimestamp() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. Signature: @@ -4148,19 +3973,23 @@ unixSecondsToTimestamp(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -## Expression.vectorLength() +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. ```typescript -// Get the vector length (dimension) of the field 'embedding'. -field("embedding").vectorLength(); +// Interpret the 'seconds' field as seconds since epoch. +field("seconds").unixSecondsToTimestamp(); ``` - A new representing the length of the vector. + +## Expression.vectorLength() + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. Signature: @@ -4171,3 +4000,14 @@ vectorLength(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the vector. + +### Example + + +```typescript +// Get the vector length (dimension) of the field 'embedding'. +field("embedding").vectorLength(); + +``` + diff --git a/docs-devsite/firestore_pipelines.field.md b/docs-devsite/firestore_pipelines.field.md index de4e5fb7b2..3a0a4aa75b 100644 --- a/docs-devsite/firestore_pipelines.field.md +++ b/docs-devsite/firestore_pipelines.field.md @@ -13,21 +13,12 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Represents a reference to a field in a Firestore document, or outputs of a stage. +Represents a reference to a field in a Firestore document, or outputs of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) stage.

Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.

You can create a `Field` instance using the static method: -```typescript -// Create a Field instance for the 'name' field -const nameField = field("name"); - -// Create a Field instance for a nested field 'address.city' -const cityField = field("address.city"); - -``` - Signature: ```typescript @@ -101,3 +92,16 @@ get fieldName(): string; ```typescript selectable: true; ``` + +### Example + + +```typescript +// Create a Field instance for the 'name' field +const nameField = field("name"); + +// Create a Field instance for a nested field 'address.city' +const cityField = field("address.city"); + +``` + diff --git a/docs-devsite/firestore_pipelines.functionexpression.md b/docs-devsite/firestore_pipelines.functionexpression.md index 6ba0bb3367..2783f8168e 100644 --- a/docs-devsite/firestore_pipelines.functionexpression.md +++ b/docs-devsite/firestore_pipelines.functionexpression.md @@ -13,9 +13,9 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -This class defines the base class for Firestore functions, which can be evaluated within pipeline execution. +This class defines the base class for Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) functions, which can be evaluated within pipeline execution. -Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_.md#and_e72c712), , or the methods on (, , etc.) to construct new Function instances. +Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_pipelines.md#and_e0c48bd), [equal()](./firestore_pipelines.md#equal_b3c3382), or the methods on [Expression](./firestore_pipelines.expression.md#expression_class) ([Expression.equal()](./firestore_pipelines.expression.md#expressionequal), [Expression.lessThan()](./firestore_pipelines.expression.md#expressionlessthan), etc.) to construct new Function instances. Signature: diff --git a/docs-devsite/firestore_pipelines.md b/docs-devsite/firestore_pipelines.md index 2a3ba65e1f..83f2763dd9 100644 --- a/docs-devsite/firestore_pipelines.md +++ b/docs-devsite/firestore_pipelines.md @@ -16,1630 +16,279 @@ https://github.com/firebase/firebase-js-sdk | Function | Description | | --- | --- | | function() | -| [countAll()](./firestore_pipelines.md#countall) | (Public Preview) Creates an aggregation that counts the total number of stage inputs. -```typescript -// Count the total number of input documents -countAll().as("totalDocument"); - -``` - A new representing the 'countAll' aggregation. | -| [currentTimestamp()](./firestore_pipelines.md#currenttimestamp) | (Public Preview) Creates an expression that evaluates to the current server timestamp. -```typescript -// Get the current server timestamp -currentTimestamp() - -``` - A new Expression representing the current server timestamp. | +| [countAll()](./firestore_pipelines.md#countall) | (Public Preview) Creates an aggregation that counts the total number of stage inputs. | +| [currentTimestamp()](./firestore_pipelines.md#currenttimestamp) | (Public Preview) Creates an expression that evaluates to the current server timestamp. | | function(array, ...) | -| [arrayContains(array, element)](./firestore_pipelines.md#arraycontains_a00ea48) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. -```typescript -// Check if the 'colors' array contains the value of field 'selectedColor' -arrayContains(field("colors"), field("selectedColor")); - -``` - | -| [arrayContains(array, element)](./firestore_pipelines.md#arraycontains_7328608) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. -```typescript -// Check if the 'colors' array contains "red" -arrayContains(field("colors"), "red"); - -``` - | -| [arrayContainsAll(array, values)](./firestore_pipelines.md#arraycontainsall_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. -```typescript -// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" -arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); - -``` - | -| [arrayContainsAll(array, arrayExpression)](./firestore_pipelines.md#arraycontainsall_7b535db) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. -```typescript -// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" -arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); - -``` - | -| [arrayContainsAny(array, values)](./firestore_pipelines.md#arraycontainsany_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. -```typescript -// Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), [field("cate1"), "Science"]); - -``` - | -| [arrayContainsAny(array, values)](./firestore_pipelines.md#arraycontainsany_c381a96) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. -```typescript -// Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), array([field("cate1"), "Science"])); - -``` - | -| [arrayLength(array)](./firestore_pipelines.md#arraylength_195e339) | (Public Preview) Creates an expression that calculates the length of an array expression. -```typescript -// Get the number of items in the 'cart' array -arrayLength(field("cart")); - -``` - | +| [arrayContains(array, element)](./firestore_pipelines.md#arraycontains_a00ea48) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. | +| [arrayContains(array, element)](./firestore_pipelines.md#arraycontains_7328608) | (Public Preview) Creates an expression that checks if an array expression contains a specific element. | +| [arrayContainsAll(array, values)](./firestore_pipelines.md#arraycontainsall_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. | +| [arrayContainsAll(array, arrayExpression)](./firestore_pipelines.md#arraycontainsall_7b535db) | (Public Preview) Creates an expression that checks if an array expression contains all the specified elements. | +| [arrayContainsAny(array, values)](./firestore_pipelines.md#arraycontainsany_c658ad5) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. | +| [arrayContainsAny(array, values)](./firestore_pipelines.md#arraycontainsany_c381a96) | (Public Preview) Creates an expression that checks if an array expression contains any of the specified elements. | +| [arrayLength(array)](./firestore_pipelines.md#arraylength_195e339) | (Public Preview) Creates an expression that calculates the length of an array expression. | | function(arrayExpression, ...) | -| [arrayGet(arrayExpression, offset)](./firestore_pipelines.md#arrayget_f2e27cc) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet(field('tags'), 1); - -``` - | -| [arrayGet(arrayExpression, offsetExpr)](./firestore_pipelines.md#arrayget_484550d) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet(field('tags'), field('favoriteTag')); - -``` - | -| [join(arrayExpression, delimiterExpression)](./firestore_pipelines.md#join_313e6aa) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join an array of string using the delimiter from the 'separator' field. -join(array(['foo', 'bar']), field("separator")) - -``` - | -| [join(arrayExpression, delimiter)](./firestore_pipelines.md#join_d088d29) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -join(field("tags"), ", ") - -``` - | +| [arrayGet(arrayExpression, offset)](./firestore_pipelines.md#arrayget_f2e27cc) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayGet(arrayExpression, offsetExpr)](./firestore_pipelines.md#arrayget_484550d) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [join(arrayExpression, delimiterExpression)](./firestore_pipelines.md#join_313e6aa) | (Public Preview) Creates an expression that joins the elements of an array into a string. | +| [join(arrayExpression, delimiter)](./firestore_pipelines.md#join_d088d29) | (Public Preview) Creates an expression that joins the elements of an array into a string. | | function(arrayField, ...) | -| [arrayGet(arrayField, offset)](./firestore_pipelines.md#arrayget_3f58471) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet('tags', 1); - -``` - | -| [arrayGet(arrayField, offsetExpr)](./firestore_pipelines.md#arrayget_1904c9a) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet('tags', field('favoriteTag')); - -``` - | +| [arrayGet(arrayField, offset)](./firestore_pipelines.md#arrayget_3f58471) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | +| [arrayGet(arrayField, offsetExpr)](./firestore_pipelines.md#arrayget_1904c9a) | (Public Preview) Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. | | function(arrayFieldName, ...) | -| [join(arrayFieldName, delimiter)](./firestore_pipelines.md#join_478ef36) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -join("tags", ", ") - -``` - | -| [join(arrayFieldName, delimiterExpression)](./firestore_pipelines.md#join_829294c) | (Public Preview) Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -join('tags', field("separator")) - -``` - | +| [join(arrayFieldName, delimiter)](./firestore_pipelines.md#join_478ef36) | (Public Preview) Creates an expression that joins the elements of an array into a string. | +| [join(arrayFieldName, delimiterExpression)](./firestore_pipelines.md#join_829294c) | (Public Preview) Creates an expression that joins the elements of an array into a string. | | function(base, ...) | -| [pow(base, exponent)](./firestore_pipelines.md#pow_e4a9e64) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow(field("base"), field("exponent")); - -``` - | -| [pow(base, exponent)](./firestore_pipelines.md#pow_93eae7f) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent. -```typescript -// Raise the value of the 'base' field to the power of 2. -pow(field("base"), 2); - -``` - | -| [pow(base, exponent)](./firestore_pipelines.md#pow_a237721) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow("base", field("exponent")); - -``` - | -| [pow(base, exponent)](./firestore_pipelines.md#pow_f4d7908) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent. -```typescript -// Raise the value of the 'base' field to the power of 2. -pow("base", 2); - -``` - | +| [pow(base, exponent)](./firestore_pipelines.md#pow_e4a9e64) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent expression. | +| [pow(base, exponent)](./firestore_pipelines.md#pow_93eae7f) | (Public Preview) Creates an expression that returns the value of the base expression raised to the power of the exponent. | +| [pow(base, exponent)](./firestore_pipelines.md#pow_a237721) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent expression. | +| [pow(base, exponent)](./firestore_pipelines.md#pow_f4d7908) | (Public Preview) Creates an expression that returns the value of the base field raised to the power of the exponent. | | function(booleanExpr, ...) | -| [countIf(booleanExpr)](./firestore_pipelines.md#countif_c5b8fb1) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true. -```typescript -// Count the number of documents where 'is_active' field equals true -countIf(field("is_active").equal(true)).as("numActiveDocuments"); - -``` - | -| [not(booleanExpr)](./firestore_pipelines.md#not_c5b8fb1) | (Public Preview) Creates an expression that negates a filter condition. -```typescript -// Find documents where the 'completed' field is NOT true -not(equal("completed", true)); - -``` - | +| [countIf(booleanExpr)](./firestore_pipelines.md#countif_c5b8fb1) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true. | +| [not(booleanExpr)](./firestore_pipelines.md#not_c5b8fb1) | (Public Preview) Creates an expression that negates a filter condition. | | function(condition, ...) | -| [conditional(condition, thenExpr, elseExpr)](./firestore_pipelines.md#conditional_07a206d) | (Public Preview) Creates a conditional expression that evaluates to a 'then' expression if a condition is true and an 'else' expression if the condition is false. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -conditional( - greaterThan("age", 18), constant("Adult"), constant("Minor")); - -``` - | +| [conditional(condition, thenExpr, elseExpr)](./firestore_pipelines.md#conditional_07a206d) | (Public Preview) Creates a conditional expression that evaluates to a 'then' expression if a condition is true and an 'else' expression if the condition is false. | | function(documentPath, ...) | -| [documentId(documentPath)](./firestore_pipelines.md#documentid_cef293c) | (Public Preview) Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(myDocumentReference); - -``` - A new representing the documentId operation. | +| [documentId(documentPath)](./firestore_pipelines.md#documentid_cef293c) | (Public Preview) Creates an expression that returns the document ID from a path. | | function(documentPathExpr, ...) | -| [documentId(documentPathExpr)](./firestore_pipelines.md#documentid_9a69021) | (Public Preview) Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(field("__path__")); - -``` - A new representing the documentId operation. | +| [documentId(documentPathExpr)](./firestore_pipelines.md#documentid_9a69021) | (Public Preview) Creates an expression that returns the document ID from a path. | | function(element, ...) | -| [notEqualAny(element, values)](./firestore_pipelines.md#notequalany_c2c5bcb) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -notEqualAny(field("status"), ["pending", field("rejectedStatus")]); - -``` - | -| [notEqualAny(element, arrayExpression)](./firestore_pipelines.md#notequalany_16b2851) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of the field 'rejectedStatus' -notEqualAny(field("status"), ["pending", field("rejectedStatus")]); - -``` - | +| [notEqualAny(element, values)](./firestore_pipelines.md#notequalany_c2c5bcb) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. | +| [notEqualAny(element, arrayExpression)](./firestore_pipelines.md#notequalany_16b2851) | (Public Preview) Creates an expression that checks if an expression is not equal to any of the provided values or expressions. | | function(elements, ...) | -| [array(elements)](./firestore_pipelines.md#array_7d853aa) | (Public Preview) Creates an expression that creates a Firestore array value from an input array. -```typescript -// Create an array value from the input array and reference the 'baz' field value from the input document. -array(['bar', Field.of('baz')]).as('foo'); - -``` - | -| [map(elements)](./firestore_pipelines.md#map_ce5dee1) | (Public Preview) Creates an expression that creates a Firestore map value from an input object. -```typescript -// Create a map from the input object and reference the 'baz' field value from the input document. -map({foo: 'bar', baz: Field.of('baz')}).as('data'); - -``` - | +| [array(elements)](./firestore_pipelines.md#array_7d853aa) | (Public Preview) Creates an expression that creates a Firestore array value from an input array. | +| [map(elements)](./firestore_pipelines.md#map_ce5dee1) | (Public Preview) Creates an expression that creates a Firestore map value from an input object. | | function(expr, ...) | | [abs(expr)](./firestore_pipelines.md#abs_005f3d4) | (Public Preview) Creates an expression that computes the absolute value of a numeric value. | -| [ascending(expr)](./firestore_pipelines.md#ascending_005f3d4) | (Public Preview) Creates an that sorts documents in ascending order based on an expression. -```typescript -// Sort documents by the 'name' field in lowercase in ascending order -firestore.pipeline().collection("users") - .sort(ascending(field("name").toLower())); - -``` - | -| [byteLength(expr)](./firestore_pipelines.md#bytelength_005f3d4) | (Public Preview) Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. -```typescript -// Calculate the length of the 'myString' field in bytes. -byteLength(field("myString")); - -``` - | +| [ascending(expr)](./firestore_pipelines.md#ascending_005f3d4) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on an expression. | +| [byteLength(expr)](./firestore_pipelines.md#bytelength_005f3d4) | (Public Preview) Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. | | [countDistinct(expr)](./firestore_pipelines.md#countdistinct_3c28b08) | (Public Preview) Creates an aggregation that counts the number of distinct values of a field. | -| [descending(expr)](./firestore_pipelines.md#descending_005f3d4) | (Public Preview) Creates an that sorts documents in descending order based on an expression. -```typescript -// Sort documents by the 'name' field in lowercase in descending order -firestore.pipeline().collection("users") - .sort(descending(field("name").toLower())); - -``` - | +| [descending(expr)](./firestore_pipelines.md#descending_005f3d4) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on an expression. | | [floor(expr)](./firestore_pipelines.md#floor_005f3d4) | (Public Preview) Creates an expression that computes the floor of a numeric value. | -| [timestampToUnixMicros(expr)](./firestore_pipelines.md#timestamptounixmicros_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to microseconds since epoch. -timestampToUnixMicros(field("timestamp")); - -``` - | -| [timestampToUnixMillis(expr)](./firestore_pipelines.md#timestamptounixmillis_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -timestampToUnixMillis(field("timestamp")); - -``` - | -| [timestampToUnixSeconds(expr)](./firestore_pipelines.md#timestamptounixseconds_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to seconds since epoch. -timestampToUnixSeconds(field("timestamp")); - -``` - | -| [unixMicrosToTimestamp(expr)](./firestore_pipelines.md#unixmicrostotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -unixMicrosToTimestamp(field("microseconds")); - -``` - | -| [unixMillisToTimestamp(expr)](./firestore_pipelines.md#unixmillistotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -unixMillisToTimestamp(field("milliseconds")); - -``` - | -| [unixSecondsToTimestamp(expr)](./firestore_pipelines.md#unixsecondstotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'seconds' field as seconds since epoch. -unixSecondsToTimestamp(field("seconds")); - -``` - | +| [timestampToUnixMicros(expr)](./firestore_pipelines.md#timestamptounixmicros_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixMillis(expr)](./firestore_pipelines.md#timestamptounixmillis_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixSeconds(expr)](./firestore_pipelines.md#timestamptounixseconds_005f3d4) | (Public Preview) Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [unixMicrosToTimestamp(expr)](./firestore_pipelines.md#unixmicrostotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixMillisToTimestamp(expr)](./firestore_pipelines.md#unixmillistotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixSecondsToTimestamp(expr)](./firestore_pipelines.md#unixsecondstotimestamp_005f3d4) | (Public Preview) Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | | function(expression, ...) | -| [arraySum(expression)](./firestore_pipelines.md#arraysum_1138a27) | (Public Preview) Creates an expression that computes the sum of the elements in an array. -```typescript -// Compute the sum of the elements in the 'scores' field. -arraySum(field("scores")); - -``` - | -| [average(expression)](./firestore_pipelines.md#average_1138a27) | (Public Preview) Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. -```typescript -// Calculate the average age of users -average(field("age")).as("averageAge"); - -``` - | -| [ceil(expression)](./firestore_pipelines.md#ceil_1138a27) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. -```typescript -// Compute the ceiling of the 'price' field. -ceil(field("price")); - -``` - | -| [collectionId(expression)](./firestore_pipelines.md#collectionid_1138a27) | (Public Preview) Creates an expression that returns the collection ID from a path. -```typescript -// Get the collection ID from a path. -collectionId(field("__name__")); - -``` - | -| [count(expression)](./firestore_pipelines.md#count_1138a27) | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. -```typescript -// Count the number of items where the price is greater than 10 -count(field("price").greaterThan(10)).as("expensiveItemCount"); - -``` - | -| [divide(expression, value)](./firestore_pipelines.md#divide_01df3cf) | (Public Preview) Creates an expression that divides an expression by a constant value. -```typescript -// Divide the 'value' field by 10 -divide(field("value"), 10); - -``` - | -| [equal(expression, value)](./firestore_pipelines.md#equal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is equal to a constant value. -```typescript -// Check if the 'age' field is equal to 21 -equal(field("age"), 21); - -``` - | -| [equalAny(expression, values)](./firestore_pipelines.md#equalany_7e759b5) | (Public Preview) Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -equalAny(field("category"), [constant("Electronics"), field("primaryType")]); - -``` - | -| [equalAny(expression, arrayExpression)](./firestore_pipelines.md#equalany_214ce68) | (Public Preview) Creates an expression that checks if an expression is equal to any of the provided values. -```typescript -// Check if the 'category' field is set to a value in the disabledCategories field -equalAny(field("category"), field('disabledCategories')); - -``` - | -| [exp(expression)](./firestore_pipelines.md#exp_1138a27) | (Public Preview) Creates an expression that computes e to the power of the expression's result. -```typescript -// Compute e to the power of 2. -exp(constant(2)); - -``` - A new representing the exp of the numeric value. | -| [greaterThan(expression, value)](./firestore_pipelines.md#greaterthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than a constant value. -```typescript -// Check if the 'age' field is greater than 18 -greaterThan(field("age"), 18); - -``` - | -| [greaterThanOrEqual(expression, value)](./firestore_pipelines.md#greaterthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than or equal to a constant value. -```typescript -// Check if the 'quantity' field is greater than or equal to 10 -greaterThanOrEqual(field("quantity"), 10); - -``` - | -| [length\_2(expression)](./firestore_pipelines.md#length_2_1138a27) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. -```typescript -// Get the length of the 'name' field. -length(field("name")); - -// Get the number of items in the 'cart' array. -length(field("cart")); - -``` - | -| [lessThan(expression, value)](./firestore_pipelines.md#lessthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than a constant value. -```typescript -// Check if the 'age' field is less than 30 -lessThan(field("age"), 30); - -``` - | -| [lessThanOrEqual(expression, value)](./firestore_pipelines.md#lessthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than or equal to a constant value. -```typescript -// Check if the 'quantity' field is less than or equal to 20 -lessThan(field("quantity"), 20); - -``` - | -| [ln(expression)](./firestore_pipelines.md#ln_1138a27) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. -```typescript -// Compute the natural logarithm of the 'value' field. -ln(field("value")); - -``` - | -| [log(expression, base)](./firestore_pipelines.md#log_ac183e2) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. -```typescript -// Compute the logarithm of the 'value' field with base 10. -log(field("value"), 10); - -``` - | -| [log(expression, base)](./firestore_pipelines.md#log_1894737) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. -```typescript -// Compute the logarithm of the 'value' field with the base in the 'base' field. -log(field("value"), field("base")); - -``` - | -| [log10(expression)](./firestore_pipelines.md#log10_1138a27) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. -```typescript -// Compute the base-10 logarithm of the 'value' field. -log10(field("value")); - -``` - | -| [maximum(expression)](./firestore_pipelines.md#maximum_1138a27) | (Public Preview) Creates an aggregation that finds the maximum value of an expression across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -maximum(field("score")).as("highestScore"); - -``` - | -| [minimum(expression)](./firestore_pipelines.md#minimum_1138a27) | (Public Preview) Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. -```typescript -// Find the lowest price of all products -minimum(field("price")).as("lowestPrice"); - -``` - | -| [mod(expression, value)](./firestore_pipelines.md#mod_01df3cf) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. -```typescript -// Calculate the remainder of dividing 'field1' by 5. -mod(field("field1"), 5); - -``` - | -| [notEqual(expression, value)](./firestore_pipelines.md#notequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is not equal to a constant value. -```typescript -// Check if the 'status' field is not equal to "completed" -notEqual(field("status"), "completed"); - -``` - | -| [round(expression)](./firestore_pipelines.md#round_1138a27) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. -```typescript -// Round the value of the 'price' field. -round(field("price")); - -``` - | -| [round(expression, decimalPlaces)](./firestore_pipelines.md#round_a3a92d0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -round(field("price"), constant(2)); - -``` - | +| [arraySum(expression)](./firestore_pipelines.md#arraysum_1138a27) | (Public Preview) Creates an expression that computes the sum of the elements in an array. | +| [average(expression)](./firestore_pipelines.md#average_1138a27) | (Public Preview) Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. | +| [ceil(expression)](./firestore_pipelines.md#ceil_1138a27) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. | +| [collectionId(expression)](./firestore_pipelines.md#collectionid_1138a27) | (Public Preview) Creates an expression that returns the collection ID from a path. | +| [count(expression)](./firestore_pipelines.md#count_1138a27) | (Public Preview) Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. | +| [divide(expression, value)](./firestore_pipelines.md#divide_01df3cf) | (Public Preview) Creates an expression that divides an expression by a constant value. | +| [equal(expression, value)](./firestore_pipelines.md#equal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is equal to a constant value. | +| [equalAny(expression, values)](./firestore_pipelines.md#equalany_7e759b5) | (Public Preview) Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. | +| [equalAny(expression, arrayExpression)](./firestore_pipelines.md#equalany_214ce68) | (Public Preview) Creates an expression that checks if an expression is equal to any of the provided values. | +| [exp(expression)](./firestore_pipelines.md#exp_1138a27) | (Public Preview) Creates an expression that computes e to the power of the expression's result. | +| [greaterThan(expression, value)](./firestore_pipelines.md#greaterthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than a constant value. | +| [greaterThanOrEqual(expression, value)](./firestore_pipelines.md#greaterthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is greater than or equal to a constant value. | +| [length\_2(expression)](./firestore_pipelines.md#length_2_1138a27) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. | +| [lessThan(expression, value)](./firestore_pipelines.md#lessthan_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than a constant value. | +| [lessThanOrEqual(expression, value)](./firestore_pipelines.md#lessthanorequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is less than or equal to a constant value. | +| [ln(expression)](./firestore_pipelines.md#ln_1138a27) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. | +| [log(expression, base)](./firestore_pipelines.md#log_ac183e2) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. | +| [log(expression, base)](./firestore_pipelines.md#log_1894737) | (Public Preview) Creates an expression that computes the logarithm of an expression to a given base. | +| [log10(expression)](./firestore_pipelines.md#log10_1138a27) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. | +| [maximum(expression)](./firestore_pipelines.md#maximum_1138a27) | (Public Preview) Creates an aggregation that finds the maximum value of an expression across multiple stage inputs. | +| [minimum(expression)](./firestore_pipelines.md#minimum_1138a27) | (Public Preview) Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. | +| [mod(expression, value)](./firestore_pipelines.md#mod_01df3cf) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. | +| [notEqual(expression, value)](./firestore_pipelines.md#notequal_01df3cf) | (Public Preview) Creates an expression that checks if an expression is not equal to a constant value. | +| [round(expression)](./firestore_pipelines.md#round_1138a27) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. | +| [round(expression, decimalPlaces)](./firestore_pipelines.md#round_a3a92d0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | | [split(expression, delimiter)](./firestore_pipelines.md#split_5b5612b) | (Public Preview) Creates an expression that splits a string into an array of substrings based on the provided delimiter. | | [split(expression, delimiter)](./firestore_pipelines.md#split_5a171ed) | (Public Preview) Creates an expression that splits a string into an array of substrings based on the provided delimiter. | -| [sqrt(expression)](./firestore_pipelines.md#sqrt_1138a27) | (Public Preview) Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt(field("value")); - -``` - | -| [subtract(expression, value)](./firestore_pipelines.md#subtract_01df3cf) | (Public Preview) Creates an expression that subtracts a constant value from an expression. -```typescript -// Subtract the constant value 2 from the 'value' field -subtract(field("value"), 2); - -``` - | -| [sum(expression)](./firestore_pipelines.md#sum_1138a27) | (Public Preview) Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -sum(field("orderAmount")).as("totalRevenue"); - -``` - | +| [sqrt(expression)](./firestore_pipelines.md#sqrt_1138a27) | (Public Preview) Creates an expression that computes the square root of a numeric value. | +| [subtract(expression, value)](./firestore_pipelines.md#subtract_01df3cf) | (Public Preview) Creates an expression that subtracts a constant value from an expression. | +| [sum(expression)](./firestore_pipelines.md#sum_1138a27) | (Public Preview) Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. | | [type(expression)](./firestore_pipelines.md#type_1138a27) | (Public Preview) Creates an expression that returns the data type of an expression's result. | | function(field, ...) | -| [isAbsent(field)](./firestore_pipelines.md#isabsent_0fb8cd4) | (Public Preview) Creates an expression that returns true if a field is absent. Otherwise, returns false even if the field value is null. -```typescript -// Check if the field `value` is absent. -isAbsent("value"); - -``` - | -| [reverse(field)](./firestore_pipelines.md#reverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. -```typescript -// Reverse the value of the 'myString' field. -reverse("myString"); - -``` - | -| [stringReverse(field)](./firestore_pipelines.md#stringreverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. -```typescript -// Reverse the value of the 'myString' field. -strReverse("myString"); - -``` - | +| [isAbsent(field)](./firestore_pipelines.md#isabsent_0fb8cd4) | (Public Preview) Creates an expression that returns true if a field is absent. Otherwise, returns false even if the field value is null. | +| [reverse(field)](./firestore_pipelines.md#reverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. | +| [stringReverse(field)](./firestore_pipelines.md#stringreverse_0fb8cd4) | (Public Preview) Creates an expression that reverses a string value in the specified field. | | [substring(field, position, length)](./firestore_pipelines.md#substring_0d9573a) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | | [substring(field, position, length)](./firestore_pipelines.md#substring_05cb14e) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | | function(fieldName, ...) | | [abs(fieldName)](./firestore_pipelines.md#abs_e5b0480) | (Public Preview) Creates an expression that computes the absolute value of a numeric value. | -| [add(fieldName, second)](./firestore_pipelines.md#add_b75bb8b) | (Public Preview) Creates an expression that adds a field's value to an expression. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -add("quantity", field("reserve")); - -``` - | -| [arrayContains(fieldName, element)](./firestore_pipelines.md#arraycontains_aaace4a) | (Public Preview) Creates an expression that checks if a field's array value contains a specific element. -```typescript -// Check if the 'colors' array contains the value of field 'selectedColor' -arrayContains("colors", field("selectedColor")); - -``` - | -| [arrayContains(fieldName, element)](./firestore_pipelines.md#arraycontains_999590f) | (Public Preview) Creates an expression that checks if a field's array value contains a specific value. -```typescript -// Check if the 'colors' array contains "red" -arrayContains("colors", "red"); - -``` - | -| [arrayContainsAll(fieldName, values)](./firestore_pipelines.md#arraycontainsall_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. -```typescript -// Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" -arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); - -``` - | -| [arrayContainsAll(fieldName, arrayExpression)](./firestore_pipelines.md#arraycontainsall_48da8d9) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. -```typescript -// Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" -arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); - -``` - | -| [arrayContainsAny(fieldName, values)](./firestore_pipelines.md#arraycontainsany_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. -```typescript -// Check if the 'groups' array contains either the value from the 'userGroup' field -// or the value "guest" -arrayContainsAny("categories", [field("cate1"), "Science"]); - -``` - | -| [arrayContainsAny(fieldName, values)](./firestore_pipelines.md#arraycontainsany_1b4f7cd) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. -```typescript -// Check if the 'groups' array contains either the value from the 'userGroup' field -// or the value "guest" -arrayContainsAny("categories", array([field("cate1"), "Science"])); - -``` - | -| [arrayLength(fieldName)](./firestore_pipelines.md#arraylength_e5b0480) | (Public Preview) Creates an expression that calculates the length of an array in a specified field. -```typescript -// Get the number of items in field 'cart' -arrayLength('cart'); - -``` - | -| [arraySum(fieldName)](./firestore_pipelines.md#arraysum_e5b0480) | (Public Preview) Creates an expression that computes the sum of the elements in an array. -```typescript -// Compute the sum of the elements in the 'scores' field. -arraySum("scores"); - -``` - | -| [ascending(fieldName)](./firestore_pipelines.md#ascending_e5b0480) | (Public Preview) Creates an that sorts documents in ascending order based on a field. -```typescript -// Sort documents by the 'name' field in ascending order -firestore.pipeline().collection("users") - .sort(ascending("name")); - -``` - | -| [average(fieldName)](./firestore_pipelines.md#average_e5b0480) | (Public Preview) Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. -```typescript -// Calculate the average age of users -average("age").as("averageAge"); - -``` - | -| [byteLength(fieldName)](./firestore_pipelines.md#bytelength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. -```typescript -// Calculate the length of the 'myString' field in bytes. -byteLength("myString"); - -``` - | -| [ceil(fieldName)](./firestore_pipelines.md#ceil_e5b0480) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. -```typescript -// Compute the ceiling of the 'price' field. -ceil("price"); - -``` - | -| [charLength(fieldName)](./firestore_pipelines.md#charlength_e5b0480) | (Public Preview) Creates an expression that calculates the character length of a string field in UTF8. -```typescript -// Get the character length of the 'name' field in UTF-8. -strLength("name"); - -``` - | -| [collectionId(fieldName)](./firestore_pipelines.md#collectionid_e5b0480) | (Public Preview) Creates an expression that returns the collection ID from a path. -```typescript -// Get the collection ID from a path. -collectionId("__name__"); - -``` - | -| [concat(fieldName, second, others)](./firestore_pipelines.md#concat_828272e) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. -```typescript -// Concatenate a field with a literal string. -concat(field("firstName"), "Doe") - -``` - | -| [cosineDistance(fieldName, vector)](./firestore_pipelines.md#cosinedistance_463a23e) | (Public Preview) Calculates the Cosine distance between a field's vector value and a literal vector value. -```typescript -// Calculate the Cosine distance between the 'location' field and a target location -cosineDistance("location", [37.7749, -122.4194]); - -``` - | -| [cosineDistance(fieldName, vectorExpression)](./firestore_pipelines.md#cosinedistance_ed766a1) | (Public Preview) Calculates the Cosine distance between a field's vector value and a vector expression. -```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -cosineDistance("userVector", field("itemVector")); - -``` - | -| [count(fieldName)](./firestore_pipelines.md#count_e5b0480) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the input field exists. -```typescript -// Count the total number of products -count("productId").as("totalProducts"); - -``` - | -| [descending(fieldName)](./firestore_pipelines.md#descending_e5b0480) | (Public Preview) Creates an that sorts documents in descending order based on a field. -```typescript -// Sort documents by the 'name' field in descending order -firestore.pipeline().collection("users") - .sort(descending("name")); - -``` - | -| [divide(fieldName, expressions)](./firestore_pipelines.md#divide_cf36e43) | (Public Preview) Creates an expression that divides a field's value by an expression. -```typescript -// Divide the 'total' field by the 'count' field -divide("total", field("count")); - -``` - | -| [divide(fieldName, value)](./firestore_pipelines.md#divide_65e2f32) | (Public Preview) Creates an expression that divides a field's value by a constant value. -```typescript -// Divide the 'value' field by 10 -divide("value", 10); - -``` - | -| [dotProduct(fieldName, vector)](./firestore_pipelines.md#dotproduct_463a23e) | (Public Preview) Calculates the dot product between a field's vector value and a double array. -```typescript -// Calculate the dot product distance between a feature vector and a target vector -dotProduct("features", [0.5, 0.8, 0.2]); - -``` - | -| [dotProduct(fieldName, vectorExpression)](./firestore_pipelines.md#dotproduct_ed766a1) | (Public Preview) Calculates the dot product between a field's vector value and a vector expression. -```typescript -// Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2' -dotProduct("docVector1", field("docVector2")); - -``` - | -| [endsWith(fieldName, suffix)](./firestore_pipelines.md#endswith_05ca3b0) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. -```typescript -// Check if the 'filename' field ends with ".txt" -endsWith("filename", ".txt"); - -``` - | -| [endsWith(fieldName, suffix)](./firestore_pipelines.md#endswith_8fc0ebc) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. -```typescript -// Check if the 'url' field ends with the value of the 'extension' field -endsWith("url", field("extension")); - -``` - | -| [equal(fieldName, expression)](./firestore_pipelines.md#equal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is equal to an expression. -```typescript -// Check if the 'age' field is equal to the 'limit' field -equal("age", field("limit")); - -``` - | -| [equal(fieldName, value)](./firestore_pipelines.md#equal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is equal to a constant value. -```typescript -// Check if the 'city' field is equal to string constant "London" -equal("city", "London"); - -``` - | -| [equalAny(fieldName, values)](./firestore_pipelines.md#equalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -equalAny("category", [constant("Electronics"), field("primaryType")]); - -``` - | -| [equalAny(fieldName, arrayExpression)](./firestore_pipelines.md#equalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. -```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -equalAny("category", ["Electronics", field("primaryType")]); - -``` - | -| [euclideanDistance(fieldName, vector)](./firestore_pipelines.md#euclideandistance_463a23e) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a double array. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location -euclideanDistance("location", [37.7749, -122.4194]); - -``` - | -| [euclideanDistance(fieldName, vectorExpression)](./firestore_pipelines.md#euclideandistance_ed766a1) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a vector expression. -```typescript -// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' -euclideanDistance("pointA", field("pointB")); - -``` - | -| [exists(fieldName)](./firestore_pipelines.md#exists_e5b0480) | (Public Preview) Creates an expression that checks if a field exists. -```typescript -// Check if the document has a field named "phoneNumber" -exists("phoneNumber"); - -``` - | -| [exp(fieldName)](./firestore_pipelines.md#exp_e5b0480) | (Public Preview) Creates an expression that computes e to the power of the expression's result. -```typescript -// Compute e to the power of the 'value' field. -exp('value'); - -``` - A new representing the exp of the numeric value. | +| [add(fieldName, second)](./firestore_pipelines.md#add_b75bb8b) | (Public Preview) Creates an expression that adds a field's value to an expression. | +| [arrayContains(fieldName, element)](./firestore_pipelines.md#arraycontains_aaace4a) | (Public Preview) Creates an expression that checks if a field's array value contains a specific element. | +| [arrayContains(fieldName, element)](./firestore_pipelines.md#arraycontains_999590f) | (Public Preview) Creates an expression that checks if a field's array value contains a specific value. | +| [arrayContainsAll(fieldName, values)](./firestore_pipelines.md#arraycontainsall_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. | +| [arrayContainsAll(fieldName, arrayExpression)](./firestore_pipelines.md#arraycontainsall_48da8d9) | (Public Preview) Creates an expression that checks if a field's array value contains all the specified values or expressions. | +| [arrayContainsAny(fieldName, values)](./firestore_pipelines.md#arraycontainsany_8060b23) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. | +| [arrayContainsAny(fieldName, values)](./firestore_pipelines.md#arraycontainsany_1b4f7cd) | (Public Preview) Creates an expression that checks if a field's array value contains any of the specified elements. | +| [arrayLength(fieldName)](./firestore_pipelines.md#arraylength_e5b0480) | (Public Preview) Creates an expression that calculates the length of an array in a specified field. | +| [arraySum(fieldName)](./firestore_pipelines.md#arraysum_e5b0480) | (Public Preview) Creates an expression that computes the sum of the elements in an array. | +| [ascending(fieldName)](./firestore_pipelines.md#ascending_e5b0480) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on a field. | +| [average(fieldName)](./firestore_pipelines.md#average_e5b0480) | (Public Preview) Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. | +| [byteLength(fieldName)](./firestore_pipelines.md#bytelength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. | +| [ceil(fieldName)](./firestore_pipelines.md#ceil_e5b0480) | (Public Preview) Creates an expression that computes the ceiling of a numeric value. | +| [charLength(fieldName)](./firestore_pipelines.md#charlength_e5b0480) | (Public Preview) Creates an expression that calculates the character length of a string field in UTF8. | +| [collectionId(fieldName)](./firestore_pipelines.md#collectionid_e5b0480) | (Public Preview) Creates an expression that returns the collection ID from a path. | +| [concat(fieldName, second, others)](./firestore_pipelines.md#concat_828272e) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. | +| [cosineDistance(fieldName, vector)](./firestore_pipelines.md#cosinedistance_463a23e) | (Public Preview) Calculates the Cosine distance between a field's vector value and a literal vector value. | +| [cosineDistance(fieldName, vectorExpression)](./firestore_pipelines.md#cosinedistance_ed766a1) | (Public Preview) Calculates the Cosine distance between a field's vector value and a vector expression. | +| [count(fieldName)](./firestore_pipelines.md#count_e5b0480) | (Public Preview) Creates an aggregation that counts the number of stage inputs where the input field exists. | +| [descending(fieldName)](./firestore_pipelines.md#descending_e5b0480) | (Public Preview) Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on a field. | +| [divide(fieldName, expressions)](./firestore_pipelines.md#divide_cf36e43) | (Public Preview) Creates an expression that divides a field's value by an expression. | +| [divide(fieldName, value)](./firestore_pipelines.md#divide_65e2f32) | (Public Preview) Creates an expression that divides a field's value by a constant value. | +| [dotProduct(fieldName, vector)](./firestore_pipelines.md#dotproduct_463a23e) | (Public Preview) Calculates the dot product between a field's vector value and a double array. | +| [dotProduct(fieldName, vectorExpression)](./firestore_pipelines.md#dotproduct_ed766a1) | (Public Preview) Calculates the dot product between a field's vector value and a vector expression. | +| [endsWith(fieldName, suffix)](./firestore_pipelines.md#endswith_05ca3b0) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. | +| [endsWith(fieldName, suffix)](./firestore_pipelines.md#endswith_8fc0ebc) | (Public Preview) Creates an expression that checks if a field's value ends with a given postfix. | +| [equal(fieldName, expression)](./firestore_pipelines.md#equal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is equal to an expression. | +| [equal(fieldName, value)](./firestore_pipelines.md#equal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is equal to a constant value. | +| [equalAny(fieldName, values)](./firestore_pipelines.md#equalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. | +| [equalAny(fieldName, arrayExpression)](./firestore_pipelines.md#equalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is equal to any of the provided values or expressions. | +| [euclideanDistance(fieldName, vector)](./firestore_pipelines.md#euclideandistance_463a23e) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a double array. | +| [euclideanDistance(fieldName, vectorExpression)](./firestore_pipelines.md#euclideandistance_ed766a1) | (Public Preview) Calculates the Euclidean distance between a field's vector value and a vector expression. | +| [exists(fieldName)](./firestore_pipelines.md#exists_e5b0480) | (Public Preview) Creates an expression that checks if a field exists. | +| [exp(fieldName)](./firestore_pipelines.md#exp_e5b0480) | (Public Preview) Creates an expression that computes e to the power of the expression's result. | | [floor(fieldName)](./firestore_pipelines.md#floor_e5b0480) | (Public Preview) Creates an expression that computes the floor of a numeric value. | -| [greaterThan(fieldName, expression)](./firestore_pipelines.md#greaterthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is greater than an expression. -```typescript -// Check if the value of field 'age' is greater than the value of field 'limit' -greaterThan("age", field("limit")); - -``` - | -| [greaterThan(fieldName, value)](./firestore_pipelines.md#greaterthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than a constant value. -```typescript -// Check if the 'price' field is greater than 100 -greaterThan("price", 100); - -``` - | -| [greaterThanOrEqual(fieldName, value)](./firestore_pipelines.md#greaterthanorequal_2e16acb) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to an expression. -```typescript -// Check if the value of field 'age' is greater than or equal to the value of field 'limit' -greaterThanOrEqual("age", field("limit")); - -``` - | -| [greaterThanOrEqual(fieldName, value)](./firestore_pipelines.md#greaterthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to a constant value. -```typescript -// Check if the 'score' field is greater than or equal to 80 -greaterThanOrEqual("score", 80); - -``` - | -| [length\_2(fieldName)](./firestore_pipelines.md#length_2_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. -```typescript -// Get the length of the 'name' field. -length("name"); - -// Get the number of items in the 'cart' array. -length("cart"); - -``` - | -| [lessThan(fieldName, expression)](./firestore_pipelines.md#lessthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than an expression. -```typescript -// Check if the 'age' field is less than the 'limit' field -lessThan("age", field("limit")); - -``` - | -| [lessThan(fieldName, value)](./firestore_pipelines.md#lessthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than a constant value. -```typescript -// Check if the 'price' field is less than 50 -lessThan("price", 50); - -``` - | -| [lessThanOrEqual(fieldName, expression)](./firestore_pipelines.md#lessthanorequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to an expression. -```typescript -// Check if the 'quantity' field is less than or equal to the 'limit' field -lessThan("quantity", field("limit")); - -``` - | -| [lessThanOrEqual(fieldName, value)](./firestore_pipelines.md#lessthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to a constant value. -```typescript -// Check if the 'score' field is less than or equal to 70 -lessThan("score", 70); - -``` - | -| [like(fieldName, pattern)](./firestore_pipelines.md#like_67f7432) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. -```typescript -// Check if the 'title' field contains the string "guide" -like("title", "%guide%"); - -``` - | -| [like(fieldName, pattern)](./firestore_pipelines.md#like_cb1318d) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. -```typescript -// Check if the 'title' field contains the string "guide" -like("title", field("pattern")); - -``` - | -| [ln(fieldName)](./firestore_pipelines.md#ln_e5b0480) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. -```typescript -// Compute the natural logarithm of the 'value' field. -ln("value"); - -``` - | -| [log(fieldName, base)](./firestore_pipelines.md#log_a89e21b) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. -```typescript -// Compute the logarithm of the 'value' field with base 10. -log("value", 10); - -``` - | -| [log(fieldName, base)](./firestore_pipelines.md#log_805b11f) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. -```typescript -// Compute the logarithm of the 'value' field with the base in the 'base' field. -log("value", field("base")); - -``` - | -| [log10(fieldName)](./firestore_pipelines.md#log10_e5b0480) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. -```typescript -// Compute the base-10 logarithm of the 'value' field. -log10("value"); - -``` - | -| [logicalMaximum(fieldName, second, others)](./firestore_pipelines.md#logicalmaximum_828272e) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. -```typescript -// Returns the largest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMaximum("field1", field("field2"), 1000); - -``` - | -| [logicalMinimum(fieldName, second, others)](./firestore_pipelines.md#logicalminimum_828272e) | (Public Preview) Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. -```typescript -// Returns the smallest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMinimum("field1", field("field2"), 1000); - -``` - | -| [mapGet(fieldName, subField)](./firestore_pipelines.md#mapget_06663cf) | (Public Preview) Accesses a value from a map (object) field using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -mapGet("address", "city"); - -``` - | -| [maximum(fieldName)](./firestore_pipelines.md#maximum_e5b0480) | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -maximum("score").as("highestScore"); - -``` - | -| [minimum(fieldName)](./firestore_pipelines.md#minimum_e5b0480) | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. -```typescript -// Find the lowest price of all products -minimum("price").as("lowestPrice"); - -``` - | -| [mod(fieldName, expression)](./firestore_pipelines.md#mod_1e91657) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. -```typescript -// Calculate the remainder of dividing 'field1' by 'field2'. -mod("field1", field("field2")); - -``` - | -| [mod(fieldName, value)](./firestore_pipelines.md#mod_65e2f32) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. -```typescript -// Calculate the remainder of dividing 'field1' by 5. -mod("field1", 5); - -``` - | -| [multiply(fieldName, second)](./firestore_pipelines.md#multiply_b75bb8b) | (Public Preview) Creates an expression that multiplies a field's value by an expression. -```typescript -// Multiply the 'quantity' field by the 'price' field -multiply("quantity", field("price")); - -``` - | -| [notEqual(fieldName, expression)](./firestore_pipelines.md#notequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is not equal to an expression. -```typescript -// Check if the 'status' field is not equal to the value of 'expectedStatus' -notEqual("status", field("expectedStatus")); - -``` - | -| [notEqual(fieldName, value)](./firestore_pipelines.md#notequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is not equal to a constant value. -```typescript -// Check if the 'country' field is not equal to "USA" -notEqual("country", "USA"); - -``` - | -| [notEqualAny(fieldName, values)](./firestore_pipelines.md#notequalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -notEqualAny("status", [constant("pending"), field("rejectedStatus")]); - -``` - | -| [notEqualAny(fieldName, arrayExpression)](./firestore_pipelines.md#notequalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. -```typescript -// Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' -notEqualAny("status", field("rejectedStatuses")); - -``` - | -| [regexContains(fieldName, pattern)](./firestore_pipelines.md#regexcontains_67f7432) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains("description", "(?i)example"); - -``` - | -| [regexContains(fieldName, pattern)](./firestore_pipelines.md#regexcontains_cb1318d) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains("description", field("pattern")); - -``` - | -| [regexMatch(fieldName, pattern)](./firestore_pipelines.md#regexmatch_67f7432) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch("email", "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); - -``` - | -| [regexMatch(fieldName, pattern)](./firestore_pipelines.md#regexmatch_cb1318d) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch("email", field("pattern")); - -``` - | -| [round(fieldName)](./firestore_pipelines.md#round_e5b0480) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. -```typescript -// Round the value of the 'price' field. -round("price"); - -``` - | -| [round(fieldName, decimalPlaces)](./firestore_pipelines.md#round_07d0cf0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. -```typescript -// Round the value of the 'price' field to two decimal places. -round("price", 2); - -``` - | +| [greaterThan(fieldName, expression)](./firestore_pipelines.md#greaterthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is greater than an expression. | +| [greaterThan(fieldName, value)](./firestore_pipelines.md#greaterthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than a constant value. | +| [greaterThanOrEqual(fieldName, value)](./firestore_pipelines.md#greaterthanorequal_2e16acb) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to an expression. | +| [greaterThanOrEqual(fieldName, value)](./firestore_pipelines.md#greaterthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is greater than or equal to a constant value. | +| [length\_2(fieldName)](./firestore_pipelines.md#length_2_e5b0480) | (Public Preview) Creates an expression that calculates the length of a string, array, map, vector, or bytes. | +| [lessThan(fieldName, expression)](./firestore_pipelines.md#lessthan_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than an expression. | +| [lessThan(fieldName, value)](./firestore_pipelines.md#lessthan_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than a constant value. | +| [lessThanOrEqual(fieldName, expression)](./firestore_pipelines.md#lessthanorequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to an expression. | +| [lessThanOrEqual(fieldName, value)](./firestore_pipelines.md#lessthanorequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is less than or equal to a constant value. | +| [like(fieldName, pattern)](./firestore_pipelines.md#like_67f7432) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. | +| [like(fieldName, pattern)](./firestore_pipelines.md#like_cb1318d) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison against a field. | +| [ln(fieldName)](./firestore_pipelines.md#ln_e5b0480) | (Public Preview) Creates an expression that computes the natural logarithm of a numeric value. | +| [log(fieldName, base)](./firestore_pipelines.md#log_a89e21b) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. | +| [log(fieldName, base)](./firestore_pipelines.md#log_805b11f) | (Public Preview) Creates an expression that computes the logarithm of a field to a given base. | +| [log10(fieldName)](./firestore_pipelines.md#log10_e5b0480) | (Public Preview) Creates an expression that computes the base-10 logarithm of a numeric value. | +| [logicalMaximum(fieldName, second, others)](./firestore_pipelines.md#logicalmaximum_828272e) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. | +| [logicalMinimum(fieldName, second, others)](./firestore_pipelines.md#logicalminimum_828272e) | (Public Preview) Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. | +| [mapGet(fieldName, subField)](./firestore_pipelines.md#mapget_06663cf) | (Public Preview) Accesses a value from a map (object) field using the provided key. | +| [maximum(fieldName)](./firestore_pipelines.md#maximum_e5b0480) | (Public Preview) Creates an aggregation that finds the maximum value of a field across multiple stage inputs. | +| [minimum(fieldName)](./firestore_pipelines.md#minimum_e5b0480) | (Public Preview) Creates an aggregation that finds the minimum value of a field across multiple stage inputs. | +| [mod(fieldName, expression)](./firestore_pipelines.md#mod_1e91657) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. | +| [mod(fieldName, value)](./firestore_pipelines.md#mod_65e2f32) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. | +| [multiply(fieldName, second)](./firestore_pipelines.md#multiply_b75bb8b) | (Public Preview) Creates an expression that multiplies a field's value by an expression. | +| [notEqual(fieldName, expression)](./firestore_pipelines.md#notequal_1e91657) | (Public Preview) Creates an expression that checks if a field's value is not equal to an expression. | +| [notEqual(fieldName, value)](./firestore_pipelines.md#notequal_65e2f32) | (Public Preview) Creates an expression that checks if a field's value is not equal to a constant value. | +| [notEqualAny(fieldName, values)](./firestore_pipelines.md#notequalany_8060b23) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. | +| [notEqualAny(fieldName, arrayExpression)](./firestore_pipelines.md#notequalany_48da8d9) | (Public Preview) Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. | +| [regexContains(fieldName, pattern)](./firestore_pipelines.md#regexcontains_67f7432) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. | +| [regexContains(fieldName, pattern)](./firestore_pipelines.md#regexcontains_cb1318d) | (Public Preview) Creates an expression that checks if a string field contains a specified regular expression as a substring. | +| [regexMatch(fieldName, pattern)](./firestore_pipelines.md#regexmatch_67f7432) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. | +| [regexMatch(fieldName, pattern)](./firestore_pipelines.md#regexmatch_cb1318d) | (Public Preview) Creates an expression that checks if a string field matches a specified regular expression. | +| [round(fieldName)](./firestore_pipelines.md#round_e5b0480) | (Public Preview) Creates an expression that rounds a numeric value to the nearest whole number. | +| [round(fieldName, decimalPlaces)](./firestore_pipelines.md#round_07d0cf0) | (Public Preview) Creates an expression that rounds a numeric value to the specified number of decimal places. | | [split(fieldName, delimiter)](./firestore_pipelines.md#split_2cfdd37) | (Public Preview) Creates an expression that splits the value of a field on the provided delimiter. | | [split(fieldName, delimiter)](./firestore_pipelines.md#split_f4fe06a) | (Public Preview) Creates an expression that splits the value of a field on the provided delimiter. | -| [sqrt(fieldName)](./firestore_pipelines.md#sqrt_e5b0480) | (Public Preview) Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt("value"); - -``` - | -| [startsWith(fieldName, prefix)](./firestore_pipelines.md#startswith_89325cc) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. -```typescript -// Check if the 'name' field starts with "Mr." -startsWith("name", "Mr."); - -``` - | -| [startsWith(fieldName, prefix)](./firestore_pipelines.md#startswith_266c338) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. -```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -startsWith("fullName", field("firstName")); - -``` - | -| [stringConcat(fieldName, secondString, otherStrings)](./firestore_pipelines.md#stringconcat_d80077e) | (Public Preview) Creates an expression that concatenates string functions, fields or constants together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat("firstName", " ", field("lastName")); - -``` - | -| [stringContains(fieldName, substring)](./firestore_pipelines.md#stringcontains_5b94cfe) | (Public Preview) Creates an expression that checks if a string field contains a specified substring. -```typescript -// Check if the 'description' field contains "example". -stringContains("description", "example"); - -``` - | -| [stringContains(fieldName, substring)](./firestore_pipelines.md#stringcontains_ac3ba47) | (Public Preview) Creates an expression that checks if a string field contains a substring specified by an expression. -```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -stringContains("description", field("keyword")); - -``` - | -| [subtract(fieldName, expression)](./firestore_pipelines.md#subtract_1e91657) | (Public Preview) Creates an expression that subtracts an expression from a field's value. -```typescript -// Subtract the 'discount' field from the 'price' field -subtract("price", field("discount")); - -``` - | -| [subtract(fieldName, value)](./firestore_pipelines.md#subtract_65e2f32) | (Public Preview) Creates an expression that subtracts a constant value from a field's value. -```typescript -// Subtract 20 from the value of the 'total' field -subtract("total", 20); - -``` - | -| [sum(fieldName)](./firestore_pipelines.md#sum_e5b0480) | (Public Preview) Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. -```typescript -// Calculate the total revenue from a set of orders -sum("orderAmount").as("totalRevenue"); - -``` - | -| [timestampAdd(fieldName, unit, amount)](./firestore_pipelines.md#timestampadd_341fe7d) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp represented by a field. -```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd("timestamp", "day", 1); - -``` - | -| [timestampSubtract(fieldName, unit, amount)](./firestore_pipelines.md#timestampsubtract_341fe7d) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. -```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract("timestamp", "day", 1); - -``` - | -| [timestampToUnixMicros(fieldName)](./firestore_pipelines.md#timestamptounixmicros_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to microseconds since epoch. -timestampToUnixMicros("timestamp"); - -``` - | -| [timestampToUnixMillis(fieldName)](./firestore_pipelines.md#timestamptounixmillis_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -timestampToUnixMillis("timestamp"); - -``` - | -| [timestampToUnixSeconds(fieldName)](./firestore_pipelines.md#timestamptounixseconds_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to seconds since epoch. -timestampToUnixSeconds("timestamp"); - -``` - | +| [sqrt(fieldName)](./firestore_pipelines.md#sqrt_e5b0480) | (Public Preview) Creates an expression that computes the square root of a numeric value. | +| [startsWith(fieldName, prefix)](./firestore_pipelines.md#startswith_89325cc) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. | +| [startsWith(fieldName, prefix)](./firestore_pipelines.md#startswith_266c338) | (Public Preview) Creates an expression that checks if a field's value starts with a given prefix. | +| [stringConcat(fieldName, secondString, otherStrings)](./firestore_pipelines.md#stringconcat_d80077e) | (Public Preview) Creates an expression that concatenates string functions, fields or constants together. | +| [stringContains(fieldName, substring)](./firestore_pipelines.md#stringcontains_5b94cfe) | (Public Preview) Creates an expression that checks if a string field contains a specified substring. | +| [stringContains(fieldName, substring)](./firestore_pipelines.md#stringcontains_ac3ba47) | (Public Preview) Creates an expression that checks if a string field contains a substring specified by an expression. | +| [subtract(fieldName, expression)](./firestore_pipelines.md#subtract_1e91657) | (Public Preview) Creates an expression that subtracts an expression from a field's value. | +| [subtract(fieldName, value)](./firestore_pipelines.md#subtract_65e2f32) | (Public Preview) Creates an expression that subtracts a constant value from a field's value. | +| [sum(fieldName)](./firestore_pipelines.md#sum_e5b0480) | (Public Preview) Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. | +| [timestampAdd(fieldName, unit, amount)](./firestore_pipelines.md#timestampadd_341fe7d) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp represented by a field. | +| [timestampSubtract(fieldName, unit, amount)](./firestore_pipelines.md#timestampsubtract_341fe7d) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. | +| [timestampToUnixMicros(fieldName)](./firestore_pipelines.md#timestamptounixmicros_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixMillis(fieldName)](./firestore_pipelines.md#timestamptounixmillis_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). | +| [timestampToUnixSeconds(fieldName)](./firestore_pipelines.md#timestamptounixseconds_e5b0480) | (Public Preview) Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). | | [timestampTruncate(fieldName, granularity, timezone)](./firestore_pipelines.md#timestamptruncate_b6c7512) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | | [timestampTruncate(fieldName, granularity, timezone)](./firestore_pipelines.md#timestamptruncate_ed83d46) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | -| [toLower(fieldName)](./firestore_pipelines.md#tolower_e5b0480) | (Public Preview) Creates an expression that converts a string field to lowercase. -```typescript -// Convert the 'name' field to lowercase -toLower("name"); - -``` - | -| [toUpper(fieldName)](./firestore_pipelines.md#toupper_e5b0480) | (Public Preview) Creates an expression that converts a string field to uppercase. -```typescript -// Convert the 'title' field to uppercase -toUpper("title"); - -``` - | -| [trim(fieldName, valueToTrim)](./firestore_pipelines.md#trim_c9f90ee) | (Public Preview) Creates an expression that removes leading and trailing whitespace from a string or byte array. -```typescript -// Trim whitespace from the 'userInput' field -trim("userInput"); - -// Trim quotes from the 'userInput' field -trim("userInput", '"'); - -``` - | +| [toLower(fieldName)](./firestore_pipelines.md#tolower_e5b0480) | (Public Preview) Creates an expression that converts a string field to lowercase. | +| [toUpper(fieldName)](./firestore_pipelines.md#toupper_e5b0480) | (Public Preview) Creates an expression that converts a string field to uppercase. | +| [trim(fieldName, valueToTrim)](./firestore_pipelines.md#trim_c9f90ee) | (Public Preview) Creates an expression that removes leading and trailing whitespace from a string or byte array. | | [type(fieldName)](./firestore_pipelines.md#type_e5b0480) | (Public Preview) Creates an expression that returns the data type of the data in the specified field. | -| [unixMicrosToTimestamp(fieldName)](./firestore_pipelines.md#unixmicrostotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -unixMicrosToTimestamp("microseconds"); - -``` - | -| [unixMillisToTimestamp(fieldName)](./firestore_pipelines.md#unixmillistotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -unixMillisToTimestamp("milliseconds"); - -``` - | -| [unixSecondsToTimestamp(fieldName)](./firestore_pipelines.md#unixsecondstotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'seconds' field as seconds since epoch. -unixSecondsToTimestamp("seconds"); - -``` - | -| [vectorLength(fieldName)](./firestore_pipelines.md#vectorlength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector represented by a field. -```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength("embedding"); - -``` - | +| [unixMicrosToTimestamp(fieldName)](./firestore_pipelines.md#unixmicrostotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixMillisToTimestamp(fieldName)](./firestore_pipelines.md#unixmillistotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [unixSecondsToTimestamp(fieldName)](./firestore_pipelines.md#unixsecondstotimestamp_e5b0480) | (Public Preview) Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. | +| [vectorLength(fieldName)](./firestore_pipelines.md#vectorlength_e5b0480) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector represented by a field. | | function(first, ...) | -| [add(first, second)](./firestore_pipelines.md#add_846ca1b) | (Public Preview) Creates an expression that adds two expressions together. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -add(field("quantity"), field("reserve")); - -``` - | -| [and(first, second, more)](./firestore_pipelines.md#and_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'AND' operation on multiple filter conditions. -```typescript -// Check if the 'age' field is greater than 18 AND the 'city' field is "London" AND -// the 'status' field is "active" -const condition = and(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); - -``` - | -| [concat(first, second, others)](./firestore_pipelines.md#concat_83be015) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. -```typescript -// Concatenate the 'firstName' and 'lastName' fields with a space in between. -concat(field("firstName"), " ", field("lastName")) - -``` - | -| [logicalMaximum(first, second, others)](./firestore_pipelines.md#logicalmaximum_83be015) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. -```typescript -// Returns the largest value between the 'field1' field, the 'field2' field, -// and 1000 -logicalMaximum(field("field1"), field("field2"), 1000); - -``` - | -| [logicalMinimum(first, second, others)](./firestore_pipelines.md#logicalminimum_83be015) | (Public Preview) Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. -```typescript -// Returns the smallest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMinimum(field("field1"), field("field2"), 1000); - -``` - | -| [multiply(first, second)](./firestore_pipelines.md#multiply_846ca1b) | (Public Preview) Creates an expression that multiplies two expressions together. -```typescript -// Multiply the 'quantity' field by the 'price' field -multiply(field("quantity"), field("price")); - -``` - | -| [or(first, second, more)](./firestore_pipelines.md#or_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'OR' operation on multiple filter conditions. -```typescript -// Check if the 'age' field is greater than 18 OR the 'city' field is "London" OR -// the 'status' field is "active" -const condition = or(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); - -``` - | -| [xor(first, second, additionalConditions)](./firestore_pipelines.md#xor_8197113) | (Public Preview) Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. -```typescript -// Check if only one of the conditions is true: 'age' greater than 18, 'city' is "London", -// or 'status' is "active". -const condition = xor( - greaterThan("age", 18), - equal("city", "London"), - equal("status", "active")); - -``` - | +| [add(first, second)](./firestore_pipelines.md#add_846ca1b) | (Public Preview) Creates an expression that adds two expressions together. | +| [and(first, second, more)](./firestore_pipelines.md#and_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'AND' operation on multiple filter conditions. | +| [concat(first, second, others)](./firestore_pipelines.md#concat_83be015) | (Public Preview) Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. | +| [logicalMaximum(first, second, others)](./firestore_pipelines.md#logicalmaximum_83be015) | (Public Preview) Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. | +| [logicalMinimum(first, second, others)](./firestore_pipelines.md#logicalminimum_83be015) | (Public Preview) Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. | +| [multiply(first, second)](./firestore_pipelines.md#multiply_846ca1b) | (Public Preview) Creates an expression that multiplies two expressions together. | +| [or(first, second, more)](./firestore_pipelines.md#or_e0c48bd) | (Public Preview) Creates an expression that performs a logical 'OR' operation on multiple filter conditions. | +| [xor(first, second, additionalConditions)](./firestore_pipelines.md#xor_8197113) | (Public Preview) Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. | | function(firstArray, ...) | -| [arrayConcat(firstArray, secondArray, otherArrays)](./firestore_pipelines.md#arrayconcat_c00d5d7) | (Public Preview) Creates an expression that concatenates an array expression with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat(field("items"), [field("newItems"), field("otherItems")]); - -``` - | -| function(firstArrayField, ...) | -| [arrayConcat(firstArrayField, secondArray, otherArrays)](./firestore_pipelines.md#arrayconcat_f92063d) | (Public Preview) Creates an expression that concatenates a field's array value with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat("items", [field("newItems"), field("otherItems")]); - -``` - | +| [arrayConcat(firstArray, secondArray, otherArrays)](./firestore_pipelines.md#arrayconcat_c00d5d7) | (Public Preview) Creates an expression that concatenates an array expression with other arrays. | +| function(firstArrayField, ...) | +| [arrayConcat(firstArrayField, secondArray, otherArrays)](./firestore_pipelines.md#arrayconcat_f92063d) | (Public Preview) Creates an expression that concatenates a field's array value with other arrays. | | function(firstMap, ...) | -| [mapMerge(firstMap, secondMap, otherMaps)](./firestore_pipelines.md#mapmerge_cfe77ce) | (Public Preview) Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - | +| [mapMerge(firstMap, secondMap, otherMaps)](./firestore_pipelines.md#mapmerge_cfe77ce) | (Public Preview) Creates an expression that merges multiple map values. | | function(firstString, ...) | -| [stringConcat(firstString, secondString, otherStrings)](./firestore_pipelines.md#stringconcat_8a8d1b6) | (Public Preview) Creates an expression that concatenates string expressions together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat(field("firstName"), " ", field("lastName")); - -``` - | +| [stringConcat(firstString, secondString, otherStrings)](./firestore_pipelines.md#stringconcat_8a8d1b6) | (Public Preview) Creates an expression that concatenates string expressions together. | | function(ifExpr, ...) | -| [ifAbsent(ifExpr, elseExpr)](./firestore_pipelines.md#ifabsent_0e6d161) | (Public Preview) Creates an expression that returns the elseExpr argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent(field("optional_field"), constant("default_value")) - -``` - | -| [ifAbsent(ifExpr, elseValue)](./firestore_pipelines.md#ifabsent_c34e5ed) | (Public Preview) Creates an expression that returns the elseValue argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent(field("optional_field"), "default_value") - -``` - | +| [ifAbsent(ifExpr, elseExpr)](./firestore_pipelines.md#ifabsent_0e6d161) | (Public Preview) Creates an expression that returns the elseExpr argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. | +| [ifAbsent(ifExpr, elseValue)](./firestore_pipelines.md#ifabsent_c34e5ed) | (Public Preview) Creates an expression that returns the elseValue argument if ifExpr is absent, else return the result of the ifExpr argument evaluation. | | function(ifFieldName, ...) | -| [ifAbsent(ifFieldName, elseExpr)](./firestore_pipelines.md#ifabsent_e6dabea) | (Public Preview) Creates an expression that returns the elseExpr argument if ifFieldName is absent, else return the value of the field. -```typescript -// Returns the value of the optional field 'optional_field', or returns the value of -// 'default_field' if 'optional_field' is absent. -ifAbsent("optional_field", field("default_field")) - -``` - | -| [ifAbsent(ifFieldName, elseValue)](./firestore_pipelines.md#ifabsent_d8f2823) | (Public Preview) Creates an expression that returns the elseValue argument if ifFieldName is absent, else return the value of the field. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent("optional_field", "default_value") - -``` - | +| [ifAbsent(ifFieldName, elseExpr)](./firestore_pipelines.md#ifabsent_e6dabea) | (Public Preview) Creates an expression that returns the elseExpr argument if ifFieldName is absent, else return the value of the field. | +| [ifAbsent(ifFieldName, elseValue)](./firestore_pipelines.md#ifabsent_d8f2823) | (Public Preview) Creates an expression that returns the elseValue argument if ifFieldName is absent, else return the value of the field. | | function(input, ...) | | [substring(input, position, length)](./firestore_pipelines.md#substring_e6e0aa3) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | | [substring(input, position, length)](./firestore_pipelines.md#substring_ab56dc6) | (Public Preview) Creates an expression that returns a substring of a string or byte array. | | function(left, ...) | -| [divide(left, right)](./firestore_pipelines.md#divide_b3c3382) | (Public Preview) Creates an expression that divides two expressions. -```typescript -// Divide the 'total' field by the 'count' field -divide(field("total"), field("count")); - -``` - | -| [equal(left, right)](./firestore_pipelines.md#equal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are equal. -```typescript -// Check if the 'age' field is equal to an expression -equal(field("age"), field("minAge").add(10)); - -``` - | -| [greaterThan(left, right)](./firestore_pipelines.md#greaterthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than the second expression. -```typescript -// Check if the 'age' field is greater than 18 -greaterThan(field("age"), Constant(9).add(9)); - -``` - | -| [greaterThanOrEqual(left, right)](./firestore_pipelines.md#greaterthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than or equal to the second expression. -```typescript -// Check if the 'quantity' field is greater than or equal to the field "threshold" -greaterThanOrEqual(field("quantity"), field("threshold")); - -``` - | -| [lessThan(left, right)](./firestore_pipelines.md#lessthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than the second expression. -```typescript -// Check if the 'age' field is less than 30 -lessThan(field("age"), field("limit")); - -``` - | -| [lessThanOrEqual(left, right)](./firestore_pipelines.md#lessthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than or equal to the second expression. -```typescript -// Check if the 'quantity' field is less than or equal to 20 -lessThan(field("quantity"), field("limit")); - -``` - | -| [mod(left, right)](./firestore_pipelines.md#mod_b3c3382) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing two expressions. -```typescript -// Calculate the remainder of dividing 'field1' by 'field2'. -mod(field("field1"), field("field2")); - -``` - | -| [notEqual(left, right)](./firestore_pipelines.md#notequal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are not equal. -```typescript -// Check if the 'status' field is not equal to field 'finalState' -notEqual(field("status"), field("finalState")); - -``` - | +| [divide(left, right)](./firestore_pipelines.md#divide_b3c3382) | (Public Preview) Creates an expression that divides two expressions. | +| [equal(left, right)](./firestore_pipelines.md#equal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are equal. | +| [greaterThan(left, right)](./firestore_pipelines.md#greaterthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than the second expression. | +| [greaterThanOrEqual(left, right)](./firestore_pipelines.md#greaterthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is greater than or equal to the second expression. | +| [lessThan(left, right)](./firestore_pipelines.md#lessthan_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than the second expression. | +| [lessThanOrEqual(left, right)](./firestore_pipelines.md#lessthanorequal_b3c3382) | (Public Preview) Creates an expression that checks if the first expression is less than or equal to the second expression. | +| [mod(left, right)](./firestore_pipelines.md#mod_b3c3382) | (Public Preview) Creates an expression that calculates the modulo (remainder) of dividing two expressions. | +| [notEqual(left, right)](./firestore_pipelines.md#notequal_b3c3382) | (Public Preview) Creates an expression that checks if two expressions are not equal. | | [pipelineResultEqual(left, right)](./firestore_pipelines.md#pipelineresultequal_707a755) | (Public Preview) Test equality of two PipelineResults. | -| [subtract(left, right)](./firestore_pipelines.md#subtract_b3c3382) | (Public Preview) Creates an expression that subtracts two expressions. -```typescript -// Subtract the 'discount' field from the 'price' field -subtract(field("price"), field("discount")); - -``` - | +| [subtract(left, right)](./firestore_pipelines.md#subtract_b3c3382) | (Public Preview) Creates an expression that subtracts two expressions. | | function(mapExpr, ...) | -| [mapRemove(mapExpr, key)](./firestore_pipelines.md#mapremove_23c7d51) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. -``` -// Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), 'baz'); - -``` - | -| [mapRemove(mapExpr, keyExpr)](./firestore_pipelines.md#mapremove_9fbcaa3) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. -``` -// Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), constant('baz')); - -``` - | +| [mapRemove(mapExpr, key)](./firestore_pipelines.md#mapremove_23c7d51) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. | +| [mapRemove(mapExpr, keyExpr)](./firestore_pipelines.md#mapremove_9fbcaa3) | (Public Preview) Creates an expression that removes a key from the map produced by evaluating an expression. | | function(mapExpression, ...) | -| [mapGet(mapExpression, subField)](./firestore_pipelines.md#mapget_688c050) | (Public Preview) Accesses a value from a map (object) expression using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -mapGet(field("address"), "city"); - -``` - | -| function(mapField, ...) | -| [mapMerge(mapField, secondMap, otherMaps)](./firestore_pipelines.md#mapmerge_70a564b) | (Public Preview) Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge('settings', { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - | -| [mapRemove(mapField, key)](./firestore_pipelines.md#mapremove_bd5726e) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. -``` -// Removes the key 'city' field from the map in the address field of the input document. -mapRemove('address', 'city'); - -``` - | -| [mapRemove(mapField, keyExpr)](./firestore_pipelines.md#mapremove_8406d13) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. -``` -// Removes the key 'city' field from the map in the address field of the input document. -mapRemove('address', constant('city')); - -``` - | -| function(name, ...) | -| [field(name)](./firestore_pipelines.md#field_1eaaff4) | (Public Preview) Creates a instance representing the field at the given path.The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city"). -```typescript -// Create a Field instance for the 'title' field -const titleField = field("title"); - -// Create a Field instance for a nested field 'author.firstName' -const authorFirstNameField = field("author.firstName"); - -``` - | -| function(options, ...) | -| [execute(options)](./firestore_pipelines.md#execute_9e87e31) | (Public Preview) Executes a pipeline and returns a Promise to represent the asynchronous operation.The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously.The pipeline results are returned as a that contains a list of objects. Each typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example:

  • If there are no stages or only transformation stages, each represents a single document.
  • If there is an aggregation, only a single is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each represents a distinct group and its associated aggregated values.

Example: -```typescript -const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") - .where(gt(field("rating"), 4.5)) - .select("title", "author", "rating")); - -const results: PipelineResults = snapshot.results; - -``` - | -| function(path, ...) | -| [field(path)](./firestore_pipelines.md#field_34ee07d) | (Public Preview) Creates a instance representing the field at the given path. | -| function(pipeline, ...) | -| [execute(pipeline)](./firestore_pipelines.md#execute_01df620) | (Public Preview) Executes a pipeline and returns a Promise to represent the asynchronous operation.The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously.The pipeline results are returned as a that contains a list of objects. Each typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example:

  • If there are no stages or only transformation stages, each represents a single document.
  • If there is an aggregation, only a single is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each represents a distinct group and its associated aggregated values.

Example: -```typescript -const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") - .where(gt(field("rating"), 4.5)) - .select("title", "author", "rating")); - -const results: PipelineResults = snapshot.results; - -``` - | -| function(stringExpression, ...) | -| [charLength(stringExpression)](./firestore_pipelines.md#charlength_c25a54a) | (Public Preview) Creates an expression that calculates the character length of a string expression in UTF-8. -```typescript -// Get the character length of the 'name' field in UTF-8. -strLength(field("name")); - -``` - | -| [endsWith(stringExpression, suffix)](./firestore_pipelines.md#endswith_0a0b889) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." -endsWith(field("fullName"), "Jr."); - -``` - | -| [endsWith(stringExpression, suffix)](./firestore_pipelines.md#endswith_13aee0d) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." -endsWith(field("fullName"), constant("Jr.")); - -``` - | -| [like(stringExpression, pattern)](./firestore_pipelines.md#like_a84c581) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. -```typescript -// Check if the 'title' field contains the string "guide" -like(field("title"), "%guide%"); - -``` - | -| [like(stringExpression, pattern)](./firestore_pipelines.md#like_b534848) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. -```typescript -// Check if the 'title' field contains the string "guide" -like(field("title"), field("pattern")); - -``` - | -| [regexContains(stringExpression, pattern)](./firestore_pipelines.md#regexcontains_a84c581) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains(field("description"), "(?i)example"); - -``` - | -| [regexContains(stringExpression, pattern)](./firestore_pipelines.md#regexcontains_b534848) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. -```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains(field("description"), field("pattern")); - -``` - | -| [regexMatch(stringExpression, pattern)](./firestore_pipelines.md#regexmatch_a84c581) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch(field("email"), "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); - -``` - | -| [regexMatch(stringExpression, pattern)](./firestore_pipelines.md#regexmatch_b534848) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. -```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch(field("email"), field("pattern")); - -``` - | -| [reverse(stringExpression)](./firestore_pipelines.md#reverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. -```typescript -// Reverse the value of the 'myString' field. -reverse(field("myString")); - -``` - | -| [startsWith(stringExpression, prefix)](./firestore_pipelines.md#startswith_75c3dbb) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." -startsWith(field("fullName"), "Mr."); - -``` - | -| [startsWith(stringExpression, prefix)](./firestore_pipelines.md#startswith_52f218a) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. -```typescript -// Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." -startsWith(field("fullName"), field("prefix")); - -``` - | -| [stringContains(stringExpression, substring)](./firestore_pipelines.md#stringcontains_3e9ff32) | (Public Preview) Creates an expression that checks if a string expression contains a specified substring. -```typescript -// Check if the 'description' field contains "example". -stringContains(field("description"), "example"); - -``` - | -| [stringContains(stringExpression, substring)](./firestore_pipelines.md#stringcontains_cc6ee02) | (Public Preview) Creates an expression that checks if a string expression contains a substring specified by another expression. -```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -stringContains(field("description"), field("keyword")); - -``` - | -| [stringReverse(stringExpression)](./firestore_pipelines.md#stringreverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. -```typescript -// Reverse the value of the 'myString' field. -strReverse(field("myString")); - -``` - | -| [toLower(stringExpression)](./firestore_pipelines.md#tolower_c25a54a) | (Public Preview) Creates an expression that converts a string expression to lowercase. -```typescript -// Convert the 'name' field to lowercase -toLower(field("name")); - -``` - | -| [toUpper(stringExpression)](./firestore_pipelines.md#toupper_c25a54a) | (Public Preview) Creates an expression that converts a string expression to uppercase. -```typescript -// Convert the 'title' field to uppercase -toUppercase(field("title")); - -``` - | -| [trim(stringExpression, valueToTrim)](./firestore_pipelines.md#trim_dd54322) | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array expression. -```typescript -// Trim whitespace from the 'userInput' field -trim(field("userInput")); - -// Trim quotes from the 'userInput' field -trim(field("userInput"), '"'); - -``` - | -| function(timestamp, ...) | -| [timestampAdd(timestamp, unit, amount)](./firestore_pipelines.md#timestampadd_98418f9) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. -```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -timestampAdd(field("timestamp"), field("unit"), field("amount")); - -``` - | -| [timestampAdd(timestamp, unit, amount)](./firestore_pipelines.md#timestampadd_ffe8e57) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. -```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd(field("timestamp"), "day", 1); - -``` - | -| [timestampSubtract(timestamp, unit, amount)](./firestore_pipelines.md#timestampsubtract_98418f9) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. -```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -timestampSubtract(field("timestamp"), field("unit"), field("amount")); - -``` - | -| [timestampSubtract(timestamp, unit, amount)](./firestore_pipelines.md#timestampsubtract_ffe8e57) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. -```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract(field("timestamp"), "day", 1); - -``` - | +| [mapGet(mapExpression, subField)](./firestore_pipelines.md#mapget_688c050) | (Public Preview) Accesses a value from a map (object) expression using the provided key. | +| function(mapField, ...) | +| [mapMerge(mapField, secondMap, otherMaps)](./firestore_pipelines.md#mapmerge_70a564b) | (Public Preview) Creates an expression that merges multiple map values. | +| [mapRemove(mapField, key)](./firestore_pipelines.md#mapremove_bd5726e) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. | +| [mapRemove(mapField, keyExpr)](./firestore_pipelines.md#mapremove_8406d13) | (Public Preview) Creates an expression that removes a key from the map at the specified field name. | +| function(name, ...) | +| [field(name)](./firestore_pipelines.md#field_1eaaff4) | (Public Preview) Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path.The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city"). | +| function(options, ...) | +| [execute(options)](./firestore_pipelines.md#execute_9e87e31) | (Public Preview) Executes a pipeline and returns a Promise to represent the asynchronous operation.The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously.The pipeline results are returned as a [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) that contains a list of [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects. Each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example:

  • If there are no stages or only transformation stages, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a single document.
  • If there is an aggregation, only a single [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a distinct group and its associated aggregated values.
| +| function(path, ...) | +| [field(path)](./firestore_pipelines.md#field_34ee07d) | (Public Preview) Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path. | +| function(pipeline, ...) | +| [execute(pipeline)](./firestore_pipelines.md#execute_01df620) | (Public Preview) Executes a pipeline and returns a Promise to represent the asynchronous operation.The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously.The pipeline results are returned as a [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) that contains a list of [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects. Each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example:
  • If there are no stages or only transformation stages, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a single document.
  • If there is an aggregation, only a single [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a distinct group and its associated aggregated values.
| +| function(stringExpression, ...) | +| [charLength(stringExpression)](./firestore_pipelines.md#charlength_c25a54a) | (Public Preview) Creates an expression that calculates the character length of a string expression in UTF-8. | +| [endsWith(stringExpression, suffix)](./firestore_pipelines.md#endswith_0a0b889) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. | +| [endsWith(stringExpression, suffix)](./firestore_pipelines.md#endswith_13aee0d) | (Public Preview) Creates an expression that checks if a string expression ends with a given postfix. | +| [like(stringExpression, pattern)](./firestore_pipelines.md#like_a84c581) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. | +| [like(stringExpression, pattern)](./firestore_pipelines.md#like_b534848) | (Public Preview) Creates an expression that performs a case-sensitive wildcard string comparison. | +| [regexContains(stringExpression, pattern)](./firestore_pipelines.md#regexcontains_a84c581) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. | +| [regexContains(stringExpression, pattern)](./firestore_pipelines.md#regexcontains_b534848) | (Public Preview) Creates an expression that checks if a string expression contains a specified regular expression as a substring. | +| [regexMatch(stringExpression, pattern)](./firestore_pipelines.md#regexmatch_a84c581) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. | +| [regexMatch(stringExpression, pattern)](./firestore_pipelines.md#regexmatch_b534848) | (Public Preview) Creates an expression that checks if a string expression matches a specified regular expression. | +| [reverse(stringExpression)](./firestore_pipelines.md#reverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. | +| [startsWith(stringExpression, prefix)](./firestore_pipelines.md#startswith_75c3dbb) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. | +| [startsWith(stringExpression, prefix)](./firestore_pipelines.md#startswith_52f218a) | (Public Preview) Creates an expression that checks if a string expression starts with a given prefix. | +| [stringContains(stringExpression, substring)](./firestore_pipelines.md#stringcontains_3e9ff32) | (Public Preview) Creates an expression that checks if a string expression contains a specified substring. | +| [stringContains(stringExpression, substring)](./firestore_pipelines.md#stringcontains_cc6ee02) | (Public Preview) Creates an expression that checks if a string expression contains a substring specified by another expression. | +| [stringReverse(stringExpression)](./firestore_pipelines.md#stringreverse_c25a54a) | (Public Preview) Creates an expression that reverses a string. | +| [toLower(stringExpression)](./firestore_pipelines.md#tolower_c25a54a) | (Public Preview) Creates an expression that converts a string expression to lowercase. | +| [toUpper(stringExpression)](./firestore_pipelines.md#toupper_c25a54a) | (Public Preview) Creates an expression that converts a string expression to uppercase. | +| [trim(stringExpression, valueToTrim)](./firestore_pipelines.md#trim_dd54322) | (Public Preview) Creates an expression that removes leading and trailing characters from a string or byte array expression. | +| function(timestamp, ...) | +| [timestampAdd(timestamp, unit, amount)](./firestore_pipelines.md#timestampadd_98418f9) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. | +| [timestampAdd(timestamp, unit, amount)](./firestore_pipelines.md#timestampadd_ffe8e57) | (Public Preview) Creates an expression that adds a specified amount of time to a timestamp. | +| [timestampSubtract(timestamp, unit, amount)](./firestore_pipelines.md#timestampsubtract_98418f9) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. | +| [timestampSubtract(timestamp, unit, amount)](./firestore_pipelines.md#timestampsubtract_ffe8e57) | (Public Preview) Creates an expression that subtracts a specified amount of time from a timestamp. | | function(timestampExpression, ...) | | [timestampTruncate(timestampExpression, granularity, timezone)](./firestore_pipelines.md#timestamptruncate_ad5d843) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | | [timestampTruncate(timestampExpression, granularity, timezone)](./firestore_pipelines.md#timestamptruncate_d6ab2a4) | (Public Preview) Creates an expression that truncates a timestamp to a specified granularity. | | function(tryExpr, ...) | -| [ifError(tryExpr, catchExpr)](./firestore_pipelines.md#iferror_a99a327) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation.This overload is useful when a BooleanExpression is required. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -ifError(constant(50).divide('length').gt(1), constant(false)); - -``` - | -| [ifError(tryExpr, catchExpr)](./firestore_pipelines.md#iferror_756c12e) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. -```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -ifError(field("title").arrayGet(0), field("title")); - -``` - | -| [ifError(tryExpr, catchValue)](./firestore_pipelines.md#iferror_dc532f9) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. -```typescript -// Returns the first item in the title field arrays, or returns -// "Default Title" -ifError(field("title").arrayGet(0), "Default Title"); - -``` - | +| [ifError(tryExpr, catchExpr)](./firestore_pipelines.md#iferror_a99a327) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation.This overload is useful when a BooleanExpression is required. | +| [ifError(tryExpr, catchExpr)](./firestore_pipelines.md#iferror_756c12e) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. | +| [ifError(tryExpr, catchValue)](./firestore_pipelines.md#iferror_dc532f9) | (Public Preview) Creates an expression that returns the catch argument if there is an error, else return the result of the try argument evaluation. | | function(value, ...) | | [constant(value)](./firestore_pipelines.md#constant_0c00f91) | (Public Preview) Creates a Constant instance for a number value. | | [constant(value)](./firestore_pipelines.md#constant_6dac335) | (Public Preview) Creates a Constant instance for a VectorValue value. | @@ -1651,78 +300,17 @@ ifError(field("title").arrayGet(0), "Default Title"); | [constant(value)](./firestore_pipelines.md#constant_5131bf7) | (Public Preview) Creates a Constant instance for a Date value. | | [constant(value)](./firestore_pipelines.md#constant_fdf565d) | (Public Preview) Creates a Constant instance for a Bytes value. | | [constant(value)](./firestore_pipelines.md#constant_bcd2b0b) | (Public Preview) Creates a Constant instance for a DocumentReference value. | -| [exists(value)](./firestore_pipelines.md#exists_f3daf14) | (Public Preview) Creates an expression that checks if a field exists. -```typescript -// Check if the document has a field named "phoneNumber" -exists(field("phoneNumber")); - -``` - | -| [isAbsent(value)](./firestore_pipelines.md#isabsent_f3daf14) | (Public Preview) Creates an expression that returns true if a value is absent. Otherwise, returns false even if the value is null. -```typescript -// Check if the field `value` is absent. -isAbsent(field("value")); - -``` - | -| [isError(value)](./firestore_pipelines.md#iserror_f3daf14) | (Public Preview) Creates an expression that checks if a given expression produces an error. -```typescript -// Check if the result of a calculation is an error -isError(field("title").arrayContains(1)); - -``` - | +| [exists(value)](./firestore_pipelines.md#exists_f3daf14) | (Public Preview) Creates an expression that checks if a field exists. | +| [isAbsent(value)](./firestore_pipelines.md#isabsent_f3daf14) | (Public Preview) Creates an expression that returns true if a value is absent. Otherwise, returns false even if the value is null. | +| [isError(value)](./firestore_pipelines.md#iserror_f3daf14) | (Public Preview) Creates an expression that checks if a given expression produces an error. | | function(vectorExpression, ...) | -| [cosineDistance(vectorExpression, vector)](./firestore_pipelines.md#cosinedistance_3a80317) | (Public Preview) Calculates the Cosine distance between a vector expression and a vector literal. -```typescript -// Calculate the cosine distance between the 'location' field and a target location -cosineDistance(field("location"), [37.7749, -122.4194]); - -``` - | -| [cosineDistance(vectorExpression, otherVectorExpression)](./firestore_pipelines.md#cosinedistance_17b5bcc) | (Public Preview) Calculates the Cosine distance between two vector expressions. -```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -cosineDistance(field("userVector"), field("itemVector")); - -``` - | -| [dotProduct(vectorExpression, vector)](./firestore_pipelines.md#dotproduct_3a80317) | (Public Preview) Calculates the dot product between a vector expression and a double array. -```typescript -// Calculate the dot product between a feature vector and a target vector -dotProduct(field("features"), [0.5, 0.8, 0.2]); - -``` - | -| [dotProduct(vectorExpression, otherVectorExpression)](./firestore_pipelines.md#dotproduct_17b5bcc) | (Public Preview) Calculates the dot product between two vector expressions. -```typescript -// Calculate the dot product between two document vectors: 'docVector1' and 'docVector2' -dotProduct(field("docVector1"), field("docVector2")); - -``` - | -| [euclideanDistance(vectorExpression, vector)](./firestore_pipelines.md#euclideandistance_3a80317) | (Public Preview) Calculates the Euclidean distance between a vector expression and a double array. -```typescript -// Calculate the Euclidean distance between the 'location' field and a target location - -euclideanDistance(field("location"), [37.7749, -122.4194]); - -``` - | -| [euclideanDistance(vectorExpression, otherVectorExpression)](./firestore_pipelines.md#euclideandistance_17b5bcc) | (Public Preview) Calculates the Euclidean distance between two vector expressions. -```typescript -// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' -euclideanDistance(field("pointA"), field("pointB")); - -``` - | -| [vectorLength(vectorExpression)](./firestore_pipelines.md#vectorlength_58a039b) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector. -```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength(field("embedding")); - -``` - | +| [cosineDistance(vectorExpression, vector)](./firestore_pipelines.md#cosinedistance_3a80317) | (Public Preview) Calculates the Cosine distance between a vector expression and a vector literal. | +| [cosineDistance(vectorExpression, otherVectorExpression)](./firestore_pipelines.md#cosinedistance_17b5bcc) | (Public Preview) Calculates the Cosine distance between two vector expressions. | +| [dotProduct(vectorExpression, vector)](./firestore_pipelines.md#dotproduct_3a80317) | (Public Preview) Calculates the dot product between a vector expression and a double array. | +| [dotProduct(vectorExpression, otherVectorExpression)](./firestore_pipelines.md#dotproduct_17b5bcc) | (Public Preview) Calculates the dot product between two vector expressions. | +| [euclideanDistance(vectorExpression, vector)](./firestore_pipelines.md#euclideandistance_3a80317) | (Public Preview) Calculates the Euclidean distance between a vector expression and a double array. | +| [euclideanDistance(vectorExpression, otherVectorExpression)](./firestore_pipelines.md#euclideandistance_17b5bcc) | (Public Preview) Calculates the Euclidean distance between two vector expressions. | +| [vectorLength(vectorExpression)](./firestore_pipelines.md#vectorlength_58a039b) | (Public Preview) Creates an expression that calculates the length of a Firestore Vector. | ## Classes @@ -1736,32 +324,23 @@ vectorLength(field("embedding")); | [CollectionReference](./firestore_pipelines.collectionreference.md#collectionreference_class) | A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using [query()](./firestore_.md#query_9f7b0f4)). | | [DocumentReference](./firestore_pipelines.documentreference.md#documentreference_class) | A DocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist. | | [DocumentSnapshot](./firestore_pipelines.documentsnapshot.md#documentsnapshot_class) | A DocumentSnapshot contains data read from a document in your Firestore database. The data can be extracted with .data() or .get(<field>) to get a specific field.For a DocumentSnapshot that points to a non-existing document, any data access will return 'undefined'. You can use the exists() method to explicitly verify a document's existence. | -| [Expression](./firestore_pipelines.expression.md#expression_class) | (Public Preview) Represents an expression that can be evaluated to a value within the execution of a .Expressions are the building blocks for creating complex queries and transformations in Firestore pipelines. They can represent:- \*\*Field references:\*\* Access values from document fields. - \*\*Literals:\*\* Represent constant values (strings, numbers, booleans). - \*\*Function calls:\*\* Apply functions to one or more expressions.The Expr class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. | -| [Field](./firestore_pipelines.field.md#field_class) | (Public Preview) Represents a reference to a field in a Firestore document, or outputs of a stage.

Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.

You can create a Field instance using the static method: -```typescript -// Create a Field instance for the 'name' field -const nameField = field("name"); - -// Create a Field instance for a nested field 'address.city' -const cityField = field("address.city"); - -``` - | +| [Expression](./firestore_pipelines.expression.md#expression_class) | (Public Preview) Represents an expression that can be evaluated to a value within the execution of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class).Expressions are the building blocks for creating complex queries and transformations in Firestore pipelines. They can represent:- \*\*Field references:\*\* Access values from document fields. - \*\*Literals:\*\* Represent constant values (strings, numbers, booleans). - \*\*Function calls:\*\* Apply functions to one or more expressions.The Expression class provides a fluent API for building expressions. You can chain together method calls to create complex expressions. | +| [Field](./firestore_pipelines.field.md#field_class) | (Public Preview) Represents a reference to a field in a Firestore document, or outputs of a [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) stage.

Field references are used to access document field values in expressions and to specify fields for sorting, filtering, and projecting data in Firestore pipelines.

You can create a Field instance using the static method: | | [FieldPath](./firestore_pipelines.fieldpath.md#fieldpath_class) | A FieldPath refers to a field in a document. The path may consist of a single field name (referring to a top-level field in the document), or a list of field names (referring to a nested field in the document).Create a FieldPath by providing field names. If more than one field name is provided, the path will point to a nested field in a document. | | [FieldValue](./firestore_pipelines.fieldvalue.md#fieldvalue_class) | Sentinel values that can be used when writing document fields with set() or update(). | | [Firestore](./firestore_pipelines.firestore.md#firestore_class) | The Cloud Firestore service interface.Do not call this constructor directly. Instead, use [getFirestore()](./firestore_.md#getfirestore). | -| [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) | (Public Preview) This class defines the base class for Firestore functions, which can be evaluated within pipeline execution.Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_.md#and_e72c712), , or the methods on (, , etc.) to construct new Function instances. | +| [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) | (Public Preview) This class defines the base class for Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) functions, which can be evaluated within pipeline execution.Typically, you would not use this class or its children directly. Use either the functions like [and()](./firestore_pipelines.md#and_e0c48bd), [equal()](./firestore_pipelines.md#equal_b3c3382), or the methods on [Expression](./firestore_pipelines.expression.md#expression_class) ([Expression.equal()](./firestore_pipelines.expression.md#expressionequal), [Expression.lessThan()](./firestore_pipelines.expression.md#expressionlessthan), etc.) to construct new Function instances. | | [GeoPoint](./firestore_pipelines.geopoint.md#geopoint_class) | An immutable object representing a geographic location in Firestore. The location is represented as latitude/longitude pair.Latitude values are in the range of \[-90, 90\]. Longitude values are in the range of \[-180, 180\]. | | [Ordering](./firestore_pipelines.ordering.md#ordering_class) | (Public Preview) Represents an ordering criterion for sorting documents in a Firestore pipeline.You create Ordering instances using the ascending and descending helper functions. | | [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) | (Public Preview) | -| [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) | (Public Preview) A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the or methods.

If the PipelineResult represents a non-document result, ref will return a undefined value. | -| [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) | (Public Preview) Represents the results of a Firestore pipeline execution.A PipelineSnapshot contains zero or more objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. | -| [PipelineSource](./firestore_pipelines.pipelinesource.md#pipelinesource_class) | (Public Preview) Provides the entry point for defining the data source of a Firestore .Use the methods of this class (e.g., , , , or ) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. | +| [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) | (Public Preview) A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the [PipelineResult.data()](./firestore_pipelines.pipelineresult.md#pipelineresultdata) or [PipelineResult.get()](./firestore_pipelines.pipelineresult.md#pipelineresultget) methods.

If the PipelineResult represents a non-document result, ref will return a undefined value. | +| [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) | (Public Preview) Represents the results of a Firestore pipeline execution.A PipelineSnapshot contains zero or more [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. | +| [PipelineSource](./firestore_pipelines.pipelinesource.md#pipelinesource_class) | (Public Preview) Provides the entry point for defining the data source of a Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class).Use the methods of this class (e.g., [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection), [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup), [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase), or [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments)) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. | | [Query](./firestore_pipelines.query.md#query_class) | A Query refers to a query which you can read or listen to. You can also construct refined Query objects by adding filters and ordering. | | [QueryDocumentSnapshot](./firestore_pipelines.querydocumentsnapshot.md#querydocumentsnapshot_class) | A QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with .data() or .get(<field>) to get a specific field.A QueryDocumentSnapshot offers the same API surface as a DocumentSnapshot. Since query results contain only existing documents, the exists property will always be true and data() will never return 'undefined'. | | [SnapshotMetadata](./firestore_pipelines.snapshotmetadata.md#snapshotmetadata_class) | Metadata about a snapshot, describing the state of the snapshot. | | [Timestamp](./firestore_pipelines.timestamp.md#timestamp_class) | A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.For examples and further specifications, refer to the [Timestamp definition](https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto). | -| [VectorValue](./firestore_pipelines.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). VectorValue | +| [VectorValue](./firestore_pipelines.vectorvalue.md#vectorvalue_class) | Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). | ## Interfaces @@ -1778,30 +357,30 @@ const cityField = field("address.city"); | Type Alias | Description | | --- | --- | -| [AddFieldsStageOptions](./firestore_pipelines.md#addfieldsstageoptions) | (Public Preview) Options defining how an AddFieldsStage is evaluated. See . | -| [AggregateStageOptions](./firestore_pipelines.md#aggregatestageoptions) | (Public Preview) Options defining how an AggregateStage is evaluated. See . | -| [CollectionGroupStageOptions](./firestore_pipelines.md#collectiongroupstageoptions) | (Public Preview) Defines the configuration options for a within a pipeline. This type extends and provides specific settings for how a collection group is identified and processed during pipeline execution. | -| [CollectionStageOptions](./firestore_pipelines.md#collectionstageoptions) | (Public Preview) Options defining how a CollectionStage is evaluated. See . | -| [DatabaseStageOptions](./firestore_pipelines.md#databasestageoptions) | (Public Preview) Options defining how a DatabaseStage is evaluated. See . | -| [DistinctStageOptions](./firestore_pipelines.md#distinctstageoptions) | (Public Preview) Options defining how a DistinctStage is evaluated. See . | -| [DocumentsStageOptions](./firestore_pipelines.md#documentsstageoptions) | (Public Preview) Options defining how a DocumentsStage is evaluated. See . | +| [AddFieldsStageOptions](./firestore_pipelines.md#addfieldsstageoptions) | (Public Preview) Options defining how an AddFieldsStage is evaluated. See [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields). | +| [AggregateStageOptions](./firestore_pipelines.md#aggregatestageoptions) | (Public Preview) Options defining how an AggregateStage is evaluated. See [Pipeline.aggregate()](./firestore_pipelines.pipeline.md#pipelineaggregate). | +| [CollectionGroupStageOptions](./firestore_pipelines.md#collectiongroupstageoptions) | (Public Preview) Defines the configuration options for a CollectionGroupStage within a pipeline. This type extends [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) and provides specific settings for how a collection group is identified and processed during pipeline execution.See [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) to create a collection group stage. | +| [CollectionStageOptions](./firestore_pipelines.md#collectionstageoptions) | (Public Preview) Options defining how a CollectionStage is evaluated. See [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection). | +| [DatabaseStageOptions](./firestore_pipelines.md#databasestageoptions) | (Public Preview) Options defining how a DatabaseStage is evaluated. See [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase). | +| [DistinctStageOptions](./firestore_pipelines.md#distinctstageoptions) | (Public Preview) Options defining how a DistinctStage is evaluated. See [Pipeline.distinct()](./firestore_pipelines.pipeline.md#pipelinedistinct). | +| [DocumentsStageOptions](./firestore_pipelines.md#documentsstageoptions) | (Public Preview) Options defining how a DocumentsStage is evaluated. See [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments). | | [ExpressionType](./firestore_pipelines.md#expressiontype) | (Public Preview) An enumeration of the different types of expressions. | -| [FindNearestStageOptions](./firestore_pipelines.md#findneareststageoptions) | (Public Preview) Options defining how a FindNearestStage is evaluated. See . | -| [LimitStageOptions](./firestore_pipelines.md#limitstageoptions) | (Public Preview) Options defining how a LimitStage is evaluated. See . | -| [OffsetStageOptions](./firestore_pipelines.md#offsetstageoptions) | (Public Preview) Options defining how an OffsetStage is evaluated. See . | -| [OneOf](./firestore_pipelines.md#oneof) | (Public Preview) Utility type to create an type that only allows one property of the Type param T to be set.type XorY = OneOf<{ x: unknown, y: unknown}> let a = { x: "foo" } // OK let b = { y: "foo" } // OK let c = { a: "foo", y: "foo" } // Not OK | +| [FindNearestStageOptions](./firestore_pipelines.md#findneareststageoptions) | (Public Preview) Options defining how a FindNearestStage is evaluated. See [Pipeline.findNearest()](./firestore_pipelines.pipeline.md#pipelinefindnearest). | +| [LimitStageOptions](./firestore_pipelines.md#limitstageoptions) | (Public Preview) Options defining how a LimitStage is evaluated. See [Pipeline.limit()](./firestore_pipelines.pipeline.md#pipelinelimit). | +| [OffsetStageOptions](./firestore_pipelines.md#offsetstageoptions) | (Public Preview) Options defining how an OffsetStage is evaluated. See [Pipeline.offset()](./firestore_pipelines.pipeline.md#pipelineoffset). | +| [OneOf](./firestore_pipelines.md#oneof) | (Public Preview) Utility type to create an type that only allows one property of the Type param T to be set. | | [PartialWithFieldValue](./firestore_pipelines.md#partialwithfieldvalue) | Similar to TypeScript's Partial<T>, but allows nested fields to be omitted and FieldValues to be passed in as property values. | | [Primitive](./firestore_pipelines.md#primitive) | Primitive types. | -| [RemoveFieldsStageOptions](./firestore_pipelines.md#removefieldsstageoptions) | (Public Preview) Options defining how a RemoveFieldsStage is evaluated. See . | -| [ReplaceWithStageOptions](./firestore_pipelines.md#replacewithstageoptions) | (Public Preview) Options defining how a ReplaceWithStage is evaluated. See . | -| [SampleStageOptions](./firestore_pipelines.md#samplestageoptions) | (Public Preview) Defines the options for evaluating a sample stage within a pipeline. This type combines common with a specific configuration where only one of the defined sampling methods can be applied.See to create a sample stage.. | -| [SelectStageOptions](./firestore_pipelines.md#selectstageoptions) | (Public Preview) Options defining how a SelectStage is evaluated. See . | +| [RemoveFieldsStageOptions](./firestore_pipelines.md#removefieldsstageoptions) | (Public Preview) Options defining how a RemoveFieldsStage is evaluated. See [Pipeline.removeFields()](./firestore_pipelines.pipeline.md#pipelineremovefields). | +| [ReplaceWithStageOptions](./firestore_pipelines.md#replacewithstageoptions) | (Public Preview) Options defining how a ReplaceWithStage is evaluated. See [Pipeline.replaceWith()](./firestore_pipelines.pipeline.md#pipelinereplacewith). | +| [SampleStageOptions](./firestore_pipelines.md#samplestageoptions) | (Public Preview) Defines the options for evaluating a sample stage within a pipeline. This type combines common [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) with a specific configuration where only one of the defined sampling methods can be applied.See [Pipeline.sample()](./firestore_pipelines.pipeline.md#pipelinesample) to create a sample stage.. | +| [SelectStageOptions](./firestore_pipelines.md#selectstageoptions) | (Public Preview) Options defining how a SelectStage is evaluated. See [Pipeline.select()](./firestore_pipelines.pipeline.md#pipelineselect). | | [SetOptions](./firestore_pipelines.md#setoptions) | An options object that configures the behavior of [setDoc()](./firestore_lite.md#setdoc_ee215ad), and calls. These calls can be configured to perform granular merges instead of overwriting the target documents in their entirety by providing a SetOptions with merge: true. | -| [SortStageOptions](./firestore_pipelines.md#sortstageoptions) | (Public Preview) Options defining how a SortStage is evaluated. See . | +| [SortStageOptions](./firestore_pipelines.md#sortstageoptions) | (Public Preview) Options defining how a SortStage is evaluated. See [Pipeline.sort()](./firestore_pipelines.pipeline.md#pipelinesort). | | [TimeGranularity](./firestore_pipelines.md#timegranularity) | (Public Preview) Specify time granularity for expressions. | -| [UnionStageOptions](./firestore_pipelines.md#unionstageoptions) | (Public Preview) Options defining how a UnionStage is evaluated. See . | +| [UnionStageOptions](./firestore_pipelines.md#unionstageoptions) | (Public Preview) Options defining how a UnionStage is evaluated. See [Pipeline.union()](./firestore_pipelines.pipeline.md#pipelineunion). | | [UnnestStageOptions](./firestore_pipelines.md#unneststageoptions) | (Public Preview) Represents the specific options available for configuring an UnnestStage within a pipeline. | -| [WhereStageOptions](./firestore_pipelines.md#wherestageoptions) | (Public Preview) Options defining how a WhereStage is evaluated. See . | +| [WhereStageOptions](./firestore_pipelines.md#wherestageoptions) | (Public Preview) Options defining how a WhereStage is evaluated. See [Pipeline.where()](./firestore_pipelines.pipeline.md#pipelinewhere). | | [WithFieldValue](./firestore_pipelines.md#withfieldvalue) | Allows FieldValues to be passed in as a property value while maintaining type safety. | ## function() @@ -1813,13 +392,6 @@ const cityField = field("address.city"); Creates an aggregation that counts the total number of stage inputs. -```typescript -// Count the total number of input documents -countAll().as("totalDocument"); - -``` - A new representing the 'countAll' aggregation. - Signature: ```typescript @@ -1829,19 +401,23 @@ export declare function countAll(): AggregateFunction; [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### currentTimestamp() {:#currenttimestamp} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'countAll' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that evaluates to the current server timestamp. ```typescript -// Get the current server timestamp -currentTimestamp() +// Count the total number of input documents +countAll().as("totalDocument"); ``` - A new Expression representing the current server timestamp. + +### currentTimestamp() {:#currenttimestamp} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that evaluates to the current server timestamp. Signature: @@ -1852,6 +428,17 @@ export declare function currentTimestamp(): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new Expression representing the current server timestamp. + +### Example + + +```typescript +// Get the current server timestamp +currentTimestamp() + +``` + ## function(array, ...) ### arrayContains(array, element) {:#arraycontains_a00ea48} @@ -1861,12 +448,6 @@ export declare function currentTimestamp(): FunctionExpression; Creates an expression that checks if an array expression contains a specific element. -```typescript -// Check if the 'colors' array contains the value of field 'selectedColor' -arrayContains(field("colors"), field("selectedColor")); - -``` - Signature: ```typescript @@ -1878,25 +459,30 @@ export declare function arrayContains(array: Expression, element: Expression): B | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_pipelines.expression.md#expression_class) | The array expression to check. | -| element | [Expression](./firestore_pipelines.expression.md#expression_class) | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| element | [Expression](./firestore_pipelines.expression.md#expression_class) | The element to search for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContains(array, element) {:#arraycontains_7328608} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains a specific element. ```typescript -// Check if the 'colors' array contains "red" -arrayContains(field("colors"), "red"); +// Check if the 'colors' array contains the value of field 'selectedColor' +arrayContains(field("colors"), field("selectedColor")); ``` +### arrayContains(array, element) {:#arraycontains_7328608} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains a specific element. + Signature: ```typescript @@ -1908,25 +494,30 @@ export declare function arrayContains(array: Expression, element: unknown): Bool | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_pipelines.expression.md#expression_class) | The array expression to check. | -| element | unknown | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| element | unknown | The element to search for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(array, values) {:#arraycontainsall_c658ad5} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains all the specified elements. ```typescript -// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" -arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); +// Check if the 'colors' array contains "red" +arrayContains(field("colors"), "red"); ``` +### arrayContainsAll(array, values) {:#arraycontainsall_c658ad5} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains all the specified elements. + Signature: ```typescript @@ -1938,18 +529,16 @@ export declare function arrayContainsAll(array: Expression, values: ArrayReturns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(array, arrayExpression) {:#arraycontainsall_7b535db} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains all the specified elements. ```typescript // Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" @@ -1957,6 +546,13 @@ arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]) ``` +### arrayContainsAll(array, arrayExpression) {:#arraycontainsall_7b535db} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains all the specified elements. + Signature: ```typescript @@ -1968,25 +564,30 @@ export declare function arrayContainsAll(array: Expression, arrayExpression: Exp | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_pipelines.expression.md#expression_class) | The array expression to check. | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The elements to check for in the array. A new representing the 'array\_contains\_all' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(array, values) {:#arraycontainsany_c658ad5} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains any of the specified elements. ```typescript -// Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), [field("cate1"), "Science"]); +// Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" +arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); ``` +### arrayContainsAny(array, values) {:#arraycontainsany_c658ad5} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains any of the specified elements. + Signature: ```typescript @@ -1998,25 +599,30 @@ export declare function arrayContainsAny(array: Expression, values: ArrayReturns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(array, values) {:#arraycontainsany_c381a96} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an array expression contains any of the specified elements. ```typescript // Check if the 'categories' array contains either values from field "cate1" or "Science" -arrayContainsAny(field("categories"), array([field("cate1"), "Science"])); +arrayContainsAny(field("categories"), [field("cate1"), "Science"]); ``` +### arrayContainsAny(array, values) {:#arraycontainsany_c381a96} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an array expression contains any of the specified elements. + Signature: ```typescript @@ -2028,25 +634,30 @@ export declare function arrayContainsAny(array: Expression, values: Expression): | Parameter | Type | Description | | --- | --- | --- | | array | [Expression](./firestore_pipelines.expression.md#expression_class) | The array expression to check. | -| values | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for in the array. A new representing the 'array\_contains\_any' comparison. | +| values | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayLength(array) {:#arraylength_195e339} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of an array expression. ```typescript -// Get the number of items in the 'cart' array -arrayLength(field("cart")); +// Check if the 'categories' array contains either values from field "cate1" or "Science" +arrayContainsAny(field("categories"), array([field("cate1"), "Science"])); ``` +### arrayLength(array) {:#arraylength_195e339} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of an array expression. + Signature: ```typescript @@ -2057,12 +668,23 @@ export declare function arrayLength(array: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| array | [Expression](./firestore_pipelines.expression.md#expression_class) | The array expression to calculate the length of. A new representing the length of the array. | +| array | [Expression](./firestore_pipelines.expression.md#expression_class) | The array expression to calculate the length of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. + +### Example + + +```typescript +// Get the number of items in the 'cart' array +arrayLength(field("cart")); + +``` + ## function(arrayExpression, ...) ### arrayGet(arrayExpression, offset) {:#arrayget_f2e27cc} @@ -2072,12 +694,6 @@ export declare function arrayLength(array: Expression): FunctionExpression; Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet(field('tags'), 1); - -``` - Signature: ```typescript @@ -2088,27 +704,31 @@ export declare function arrayGet(arrayExpression: Expression, offset: number): F | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expr evaluating to an array. | -| offset | number | The index of the element to return. A new Expr representing the 'arrayGet' operation. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expression evaluating to an array. | +| offset | number | The index of the element to return. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### arrayGet(arrayExpression, offsetExpr) {:#arrayget_484550d} +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet(field('tags'), field('favoriteTag')); +// Return the value in the tags field array at index 1. +arrayGet(field('tags'), 1); ``` +### arrayGet(arrayExpression, offsetExpr) {:#arrayget_484550d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript @@ -2119,25 +739,31 @@ export declare function arrayGet(arrayExpression: Expression, offsetExpr: Expres | Parameter | Type | Description | | --- | --- | --- | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expr evaluating to an array. | -| offsetExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expr evaluating to the index of the element to return. A new Expr representing the 'arrayGet' operation. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expression evaluating to an array. | +| offsetExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expression evaluating to the index of the element to return. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### join(arrayExpression, delimiterExpression) {:#join_313e6aa} +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join an array of string using the delimiter from the 'separator' field. -join(array(['foo', 'bar']), field("separator")) +// Return the value in the tags field array at index specified by field +// 'favoriteTag'. +arrayGet(field('tags'), field('favoriteTag')); + +``` + +### join(arrayExpression, delimiterExpression) {:#join_313e6aa} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -``` +Creates an expression that joins the elements of an array into a string. Signature: @@ -2150,25 +776,30 @@ export declare function join(arrayExpression: Expression, delimiterExpression: E | Parameter | Type | Description | | --- | --- | --- | | arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array. | -| delimiterExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. A new Expression representing the join operation. | +| delimiterExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) -### join(arrayExpression, delimiter) {:#join_d088d29} +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join the elements of the 'tags' field with a comma and space. -join(field("tags"), ", ") +// Join an array of string using the delimiter from the 'separator' field. +join(array(['foo', 'bar']), field("separator")) ``` +### join(arrayExpression, delimiter) {:#join_d088d29} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array into a string. + Signature: ```typescript @@ -2180,12 +811,23 @@ export declare function join(arrayExpression: Expression, delimiter: string): Ex | Parameter | Type | Description | | --- | --- | --- | | arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array. | -| delimiter | string | The string to use as a delimiter. A new Expression representing the join operation. | +| delimiter | string | The string to use as a delimiter. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new Expression representing the join operation. + +### Example + + +```typescript +// Join the elements of the 'tags' field with a comma and space. +join(field("tags"), ", ") + +``` + ## function(arrayField, ...) ### arrayGet(arrayField, offset) {:#arrayget_3f58471} @@ -2195,12 +837,6 @@ export declare function join(arrayExpression: Expression, delimiter: string): Ex Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. -```typescript -// Return the value in the tags field array at index 1. -arrayGet('tags', 1); - -``` - Signature: ```typescript @@ -2212,26 +848,30 @@ export declare function arrayGet(arrayField: string, offset: number): FunctionEx | Parameter | Type | Description | | --- | --- | --- | | arrayField | string | The name of the array field. | -| offset | number | The index of the element to return. A new Expr representing the 'arrayGet' operation. | +| offset | number | The index of the element to return. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### arrayGet(arrayField, offsetExpr) {:#arrayget_1904c9a} +A new `Expression` representing the 'arrayGet' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. ```typescript -// Return the value in the tags field array at index specified by field -// 'favoriteTag'. -arrayGet('tags', field('favoriteTag')); +// Return the value in the tags field array at index 1. +arrayGet('tags', 1); ``` +### arrayGet(arrayField, offsetExpr) {:#arrayget_1904c9a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that indexes into an array from the beginning or end and return the element. If the offset exceeds the array length, an error is returned. A negative offset, starts from the end. + Signature: ```typescript @@ -2243,12 +883,24 @@ export declare function arrayGet(arrayField: string, offsetExpr: Expression): Fu | Parameter | Type | Description | | --- | --- | --- | | arrayField | string | The name of the array field. | -| offsetExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expr evaluating to the index of the element to return. A new Expr representing the 'arrayGet' operation. | +| offsetExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | An Expression evaluating to the index of the element to return. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the 'arrayGet' operation. + +### Example + + +```typescript +// Return the value in the tags field array at index specified by field +// 'favoriteTag'. +arrayGet('tags', field('favoriteTag')); + +``` + ## function(arrayFieldName, ...) ### join(arrayFieldName, delimiter) {:#join_478ef36} @@ -2258,12 +910,6 @@ export declare function arrayGet(arrayField: string, offsetExpr: Expression): Fu Creates an expression that joins the elements of an array into a string. -```typescript -// Join the elements of the 'tags' field with a comma and space. -join("tags", ", ") - -``` - Signature: ```typescript @@ -2275,25 +921,30 @@ export declare function join(arrayFieldName: string, delimiter: string): Express | Parameter | Type | Description | | --- | --- | --- | | arrayFieldName | string | The name of the field containing the array. | -| delimiter | string | The string to use as a delimiter. A new Expression representing the join operation. | +| delimiter | string | The string to use as a delimiter. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) -### join(arrayFieldName, delimiterExpression) {:#join_829294c} +A new Expression representing the join operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that joins the elements of an array into a string. ```typescript -// Join the elements of the 'tags' field with the delimiter from the 'separator' field. -join('tags', field("separator")) +// Join the elements of the 'tags' field with a comma and space. +join("tags", ", ") ``` +### join(arrayFieldName, delimiterExpression) {:#join_829294c} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that joins the elements of an array into a string. + Signature: ```typescript @@ -2305,12 +956,23 @@ export declare function join(arrayFieldName: string, delimiterExpression: Expres | Parameter | Type | Description | | --- | --- | --- | | arrayFieldName | string | The name of the field containing the array. | -| delimiterExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. A new Expression representing the join operation. | +| delimiterExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that evaluates to the delimiter string. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new Expression representing the join operation. + +### Example + + +```typescript +// Join the elements of the 'tags' field with the delimiter from the 'separator' field. +join('tags', field("separator")) + +``` + ## function(base, ...) ### pow(base, exponent) {:#pow_e4a9e64} @@ -2320,12 +982,6 @@ export declare function join(arrayFieldName: string, delimiterExpression: Expres Creates an expression that returns the value of the base expression raised to the power of the exponent expression. -```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow(field("base"), field("exponent")); - -``` - Signature: ```typescript @@ -2337,25 +993,30 @@ export declare function pow(base: Expression, exponent: Expression): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | base | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise to the power of the exponent. | -| exponent | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. A new Expr representing the power operation. | +| exponent | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### pow(base, exponent) {:#pow_93eae7f} +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of the base expression raised to the power of the exponent. ```typescript -// Raise the value of the 'base' field to the power of 2. -pow(field("base"), 2); +// Raise the value of the 'base' field to the power of the 'exponent' field. +pow(field("base"), field("exponent")); ``` +### pow(base, exponent) {:#pow_93eae7f} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of the base expression raised to the power of the exponent. + Signature: ```typescript @@ -2367,25 +1028,30 @@ export declare function pow(base: Expression, exponent: number): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | | base | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise to the power of the exponent. | -| exponent | number | The constant value to raise the base to the power of. A new Expr representing the power operation. | +| exponent | number | The constant value to raise the base to the power of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### pow(base, exponent) {:#pow_a237721} +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of the base field raised to the power of the exponent expression. ```typescript -// Raise the value of the 'base' field to the power of the 'exponent' field. -pow("base", field("exponent")); +// Raise the value of the 'base' field to the power of 2. +pow(field("base"), 2); ``` +### pow(base, exponent) {:#pow_a237721} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of the base field raised to the power of the exponent expression. + Signature: ```typescript @@ -2397,25 +1063,30 @@ export declare function pow(base: string, exponent: Expression): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | | base | string | The name of the field to raise to the power of the exponent. | -| exponent | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. A new Expr representing the power operation. | +| exponent | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to raise the base to the power of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### pow(base, exponent) {:#pow_f4d7908} +A new `Expression` representing the power operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the value of the base field raised to the power of the exponent. ```typescript -// Raise the value of the 'base' field to the power of 2. -pow("base", 2); +// Raise the value of the 'base' field to the power of the 'exponent' field. +pow("base", field("exponent")); ``` +### pow(base, exponent) {:#pow_f4d7908} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the value of the base field raised to the power of the exponent. + Signature: ```typescript @@ -2427,12 +1098,23 @@ export declare function pow(base: string, exponent: number): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | | base | string | The name of the field to raise to the power of the exponent. | -| exponent | number | The constant value to raise the base to the power of. A new Expr representing the power operation. | +| exponent | number | The constant value to raise the base to the power of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the power operation. + +### Example + + +```typescript +// Raise the value of the 'base' field to the power of 2. +pow("base", 2); + +``` + ## function(booleanExpr, ...) ### countIf(booleanExpr) {:#countif_c5b8fb1} @@ -2442,12 +1124,6 @@ export declare function pow(base: string, exponent: number): FunctionExpression; Creates an aggregation that counts the number of stage inputs where the provided boolean expression evaluates to true. -```typescript -// Count the number of documents where 'is_active' field equals true -countIf(field("is_active").equal(true)).as("numActiveDocuments"); - -``` - Signature: ```typescript @@ -2466,6 +1142,15 @@ export declare function countIf(booleanExpr: BooleanExpression): AggregateFuncti A new `AggregateFunction` representing the 'countIf' aggregation. +### Example + + +```typescript +// Count the number of documents where 'is_active' field equals true +countIf(field("is_active").equal(true)).as("numActiveDocuments"); + +``` + ### not(booleanExpr) {:#not_c5b8fb1} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2473,12 +1158,6 @@ A new `AggregateFunction` representing the 'countIf' aggregation. Creates an expression that negates a filter condition. -```typescript -// Find documents where the 'completed' field is NOT true -not(equal("completed", true)); - -``` - Signature: ```typescript @@ -2489,12 +1168,23 @@ export declare function not(booleanExpr: BooleanExpression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| booleanExpr | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The filter condition to negate. A new representing the negated filter condition. | +| booleanExpr | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The filter condition to negate. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the negated filter condition. + +### Example + + +```typescript +// Find documents where the 'completed' field is NOT true +not(equal("completed", true)); + +``` + ## function(condition, ...) ### conditional(condition, thenExpr, elseExpr) {:#conditional_07a206d} @@ -2504,13 +1194,6 @@ export declare function not(booleanExpr: BooleanExpression): BooleanExpression; Creates a conditional expression that evaluates to a 'then' expression if a condition is true and an 'else' expression if the condition is false. -```typescript -// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". -conditional( - greaterThan("age", 18), constant("Adult"), constant("Minor")); - -``` - Signature: ```typescript @@ -2523,12 +1206,24 @@ export declare function conditional(condition: BooleanExpression, thenExpr: Expr | --- | --- | --- | | condition | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The condition to evaluate. | | thenExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is true. | -| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. A new representing the conditional expression. | +| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to evaluate if the condition is false. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the conditional expression. + +### Example + + +```typescript +// If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". +conditional( + greaterThan("age", 18), constant("Adult"), constant("Minor")); + +``` + ## function(documentPath, ...) ### documentId(documentPath) {:#documentid_cef293c} @@ -2538,13 +1233,6 @@ export declare function conditional(condition: BooleanExpression, thenExpr: Expr Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(myDocumentReference); - -``` - A new representing the documentId operation. - Signature: ```typescript @@ -2561,6 +1249,17 @@ export declare function documentId(documentPath: string | DocumentReference): Fu [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the documentId operation. + +### Example + + +```typescript +// Get the document ID from a path. +documentId(myDocumentReference); + +``` + ## function(documentPathExpr, ...) ### documentId(documentPathExpr) {:#documentid_9a69021} @@ -2570,13 +1269,6 @@ export declare function documentId(documentPath: string | DocumentReference): Fu Creates an expression that returns the document ID from a path. -```typescript -// Get the document ID from a path. -documentId(field("__path__")); - -``` - A new representing the documentId operation. - Signature: ```typescript @@ -2593,6 +1285,17 @@ export declare function documentId(documentPathExpr: Expression): FunctionExpres [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the documentId operation. + +### Example + + +```typescript +// Get the document ID from a path. +documentId(field("__path__")); + +``` + ## function(element, ...) ### notEqualAny(element, values) {:#notequalany_c2c5bcb} @@ -2602,12 +1305,6 @@ export declare function documentId(documentPathExpr: Expression): FunctionExpres Creates an expression that checks if an expression is not equal to any of the provided values or expressions. -```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -notEqualAny(field("status"), ["pending", field("rejectedStatus")]); - -``` - Signature: ```typescript @@ -2619,11 +1316,22 @@ export declare function notEqualAny(element: Expression, values: ArrayReturns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. + +### Example + + +```typescript +// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' +notEqualAny(field("status"), ["pending", field("rejectedStatus")]); + +``` ### notEqualAny(element, arrayExpression) {:#notequalany_16b2851} @@ -2632,12 +1340,6 @@ export declare function notEqualAny(element: Expression, values: ArraySignature: ```typescript @@ -2649,12 +1351,23 @@ export declare function notEqualAny(element: Expression, arrayExpression: Expres | Parameter | Type | Description | | --- | --- | --- | | element | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare. | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The values to check against. A new representing the 'NOT IN' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The values to check against. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. + +### Example + + +```typescript +// Check if the 'status' field is neither "pending" nor the value of the field 'rejectedStatus' +notEqualAny(field("status"), ["pending", field("rejectedStatus")]); + +``` + ## function(elements, ...) ### array(elements) {:#array_7d853aa} @@ -2664,12 +1377,6 @@ export declare function notEqualAny(element: Expression, arrayExpression: Expres Creates an expression that creates a Firestore array value from an input array. -```typescript -// Create an array value from the input array and reference the 'baz' field value from the input document. -array(['bar', Field.of('baz')]).as('foo'); - -``` - Signature: ```typescript @@ -2680,25 +1387,30 @@ export declare function array(elements: unknown[]): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| elements | unknown\[\] | The input array to evaluate in the expression. A new representing the array function. | +| elements | unknown\[\] | The input array to evaluate in the expression. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### map(elements) {:#map_ce5dee1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the array function. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that creates a Firestore map value from an input object. ```typescript -// Create a map from the input object and reference the 'baz' field value from the input document. -map({foo: 'bar', baz: Field.of('baz')}).as('data'); +// Create an array value from the input array and reference the 'baz' field value from the input document. +array(['bar', Field.of('baz')]).as('foo'); ``` +### map(elements) {:#map_ce5dee1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that creates a Firestore map value from an input object. + Signature: ```typescript @@ -2709,12 +1421,23 @@ export declare function map(elements: Record): FunctionExpressi | Parameter | Type | Description | | --- | --- | --- | -| elements | Record<string, unknown> | The input map to evaluate in the expression. A new representing the map function. | +| elements | Record<string, unknown> | The input map to evaluate in the expression. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the map function. + +### Example + + +```typescript +// Create a map from the input object and reference the 'baz' field value from the input document. +map({foo: 'bar', baz: Field.of('baz')}).as('data'); + +``` + ## function(expr, ...) ### abs(expr) {:#abs_005f3d4} @@ -2734,25 +1457,20 @@ export declare function abs(expr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compute the absolute value of. A new representing the absolute value of the numeric value. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compute the absolute value of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the absolute value of the numeric value. + ### ascending(expr) {:#ascending_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an that sorts documents in ascending order based on an expression. - -```typescript -// Sort documents by the 'name' field in lowercase in ascending order -firestore.pipeline().collection("users") - .sort(ascending(field("name").toLower())); - -``` +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on an expression. Signature: @@ -2764,25 +1482,31 @@ export declare function ascending(expr: Expression): Ordering; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to create an ascending ordering for. A new Ordering for ascending sorting. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to create an ascending ordering for. | Returns: [Ordering](./firestore_pipelines.ordering.md#ordering_class) -### byteLength(expr) {:#bytelength_005f3d4} +A new `Ordering` for ascending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. ```typescript -// Calculate the length of the 'myString' field in bytes. -byteLength(field("myString")); +// Sort documents by the 'name' field in lowercase in ascending order +firestore.pipeline().collection("users") + .sort(ascending(field("name").toLower())); ``` +### byteLength(expr) {:#bytelength_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. + Signature: ```typescript @@ -2793,12 +1517,23 @@ export declare function byteLength(expr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string. A new representing the length of the string in bytes. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string in bytes. + +### Example + + +```typescript +// Calculate the length of the 'myString' field in bytes. +byteLength(field("myString")); + +``` + ### countDistinct(expr) {:#countdistinct_3c28b08} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2816,25 +1551,20 @@ export declare function countDistinct(expr: Expression | string): AggregateFunct | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) \| string | The expression or field to count distinct values of. A new AggregateFunction representing the 'count\_distinct' aggregation. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) \| string | The expression or field to count distinct values of. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) +A new `AggregateFunction` representing the 'count\_distinct' aggregation. + ### descending(expr) {:#descending_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an that sorts documents in descending order based on an expression. - -```typescript -// Sort documents by the 'name' field in lowercase in descending order -firestore.pipeline().collection("users") - .sort(descending(field("name").toLower())); - -``` +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on an expression. Signature: @@ -2846,12 +1576,24 @@ export declare function descending(expr: Expression): Ordering; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to create a descending ordering for. A new Ordering for descending sorting. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to create a descending ordering for. | Returns: [Ordering](./firestore_pipelines.ordering.md#ordering_class) +A new `Ordering` for descending sorting. + +### Example + + +```typescript +// Sort documents by the 'name' field in lowercase in descending order +firestore.pipeline().collection("users") + .sort(descending(field("name").toLower())); + +``` + ### floor(expr) {:#floor_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2869,12 +1611,14 @@ export declare function floor(expr: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compute the floor of. A new representing the floor of the numeric value. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compute the floor of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the floor of the numeric value. + ### timestampToUnixMicros(expr) {:#timestamptounixmicros_005f3d4} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -2882,12 +1626,6 @@ export declare function floor(expr: Expression): FunctionExpression; Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). -```typescript -// Convert the 'timestamp' field to microseconds since epoch. -timestampToUnixMicros(field("timestamp")); - -``` - Signature: ```typescript @@ -2898,25 +1636,30 @@ export declare function timestampToUnixMicros(expr: Expression): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. A new representing the number of microseconds since epoch. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixMillis(expr) {:#timestamptounixmillis_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of microseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -timestampToUnixMillis(field("timestamp")); +// Convert the 'timestamp' field to microseconds since epoch. +timestampToUnixMicros(field("timestamp")); ``` +### timestampToUnixMillis(expr) {:#timestamptounixmillis_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -2927,25 +1670,30 @@ export declare function timestampToUnixMillis(expr: Expression): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. A new representing the number of milliseconds since epoch. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixSeconds(expr) {:#timestamptounixseconds_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of milliseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to seconds since epoch. -timestampToUnixSeconds(field("timestamp")); +// Convert the 'timestamp' field to milliseconds since epoch. +timestampToUnixMillis(field("timestamp")); ``` +### timestampToUnixSeconds(expr) {:#timestamptounixseconds_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -2956,25 +1704,30 @@ export declare function timestampToUnixSeconds(expr: Expression): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. A new representing the number of seconds since epoch. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### unixMicrosToTimestamp(expr) {:#unixmicrostotimestamp_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of seconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -unixMicrosToTimestamp(field("microseconds")); +// Convert the 'timestamp' field to seconds since epoch. +timestampToUnixSeconds(field("timestamp")); ``` +### unixMicrosToTimestamp(expr) {:#unixmicrostotimestamp_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript @@ -2985,25 +1738,30 @@ export declare function unixMicrosToTimestamp(expr: Expression): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the number of microseconds since epoch. A new representing the timestamp. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the number of microseconds since epoch. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### unixMillisToTimestamp(expr) {:#unixmillistotimestamp_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -unixMillisToTimestamp(field("milliseconds")); +// Interpret the 'microseconds' field as microseconds since epoch. +unixMicrosToTimestamp(field("microseconds")); ``` +### unixMillisToTimestamp(expr) {:#unixmillistotimestamp_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript @@ -3014,25 +1772,30 @@ export declare function unixMillisToTimestamp(expr: Expression): FunctionExpress | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the number of milliseconds since epoch. A new representing the timestamp. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the number of milliseconds since epoch. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### unixSecondsToTimestamp(expr) {:#unixsecondstotimestamp_005f3d4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'seconds' field as seconds since epoch. -unixSecondsToTimestamp(field("seconds")); +// Interpret the 'milliseconds' field as milliseconds since epoch. +unixMillisToTimestamp(field("milliseconds")); ``` +### unixSecondsToTimestamp(expr) {:#unixsecondstotimestamp_005f3d4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript @@ -3043,12 +1806,23 @@ export declare function unixSecondsToTimestamp(expr: Expression): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the number of seconds since epoch. A new representing the timestamp. | +| expr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the number of seconds since epoch. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. + +### Example + + +```typescript +// Interpret the 'seconds' field as seconds since epoch. +unixSecondsToTimestamp(field("seconds")); + +``` + ## function(expression, ...) ### arraySum(expression) {:#arraysum_1138a27} @@ -3058,12 +1832,6 @@ export declare function unixSecondsToTimestamp(expr: Expression): FunctionExpres Creates an expression that computes the sum of the elements in an array. -```typescript -// Compute the sum of the elements in the 'scores' field. -arraySum(field("scores")); - -``` - Signature: ```typescript @@ -3074,25 +1842,30 @@ export declare function arraySum(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric array, which the sum will be computed for. A new Expr representing the sum of the elements in the array. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric array, which the sum will be computed for. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### average(expression) {:#average_1138a27} +A new `Expression` representing the sum of the elements in the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. ```typescript -// Calculate the average age of users -average(field("age")).as("averageAge"); +// Compute the sum of the elements in the 'scores' field. +arraySum(field("scores")); ``` +### average(expression) {:#average_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the average (mean) of values from an expression across multiple stage inputs. + Signature: ```typescript @@ -3103,25 +1876,30 @@ export declare function average(expression: Expression): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the values to average. A new representing the 'average' aggregation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the values to average. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### ceil(expression) {:#ceil_1138a27} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'average' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the ceiling of a numeric value. ```typescript -// Compute the ceiling of the 'price' field. -ceil(field("price")); +// Calculate the average age of users +average(field("age")).as("averageAge"); ``` +### ceil(expression) {:#ceil_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the ceiling of a numeric value. + Signature: ```typescript @@ -3132,24 +1910,29 @@ export declare function ceil(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the ceiling will be computed for. A new representing the ceiling of the numeric value. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the ceiling will be computed for. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### collectionId(expression) {:#collectionid_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the ceiling of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the collection ID from a path. ```typescript -// Get the collection ID from a path. -collectionId(field("__name__")); +// Compute the ceiling of the 'price' field. +ceil(field("price")); + +``` + +### collectionId(expression) {:#collectionid_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> -``` +Creates an expression that returns the collection ID from a path. Signature: @@ -3161,25 +1944,30 @@ export declare function collectionId(expression: Expression): FunctionExpression | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a path, which the collection ID will be extracted from. A new representing the collectionId operation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a path, which the collection ID will be extracted from. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### count(expression) {:#count_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the collectionId operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. ```typescript -// Count the number of items where the price is greater than 10 -count(field("price").greaterThan(10)).as("expensiveItemCount"); +// Get the collection ID from a path. +collectionId(field("__name__")); ``` +### count(expression) {:#count_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of stage inputs with valid evaluations of the provided expression. + Signature: ```typescript @@ -3190,25 +1978,30 @@ export declare function count(expression: Expression): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to count. A new representing the 'count' aggregation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to count. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### divide(expression, value) {:#divide_01df3cf} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'count' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides an expression by a constant value. ```typescript -// Divide the 'value' field by 10 -divide(field("value"), 10); +// Count the number of items where the price is greater than 10 +count(field("price").greaterThan(10)).as("expensiveItemCount"); ``` +### divide(expression, value) {:#divide_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides an expression by a constant value. + Signature: ```typescript @@ -3220,25 +2013,30 @@ export declare function divide(expression: Expression, value: unknown): Function | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to be divided. | -| value | unknown | The constant value to divide by. A new representing the division operation. | +| value | unknown | The constant value to divide by. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### equal(expression, value) {:#equal_01df3cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is equal to a constant value. ```typescript -// Check if the 'age' field is equal to 21 -equal(field("age"), 21); +// Divide the 'value' field by 10 +divide(field("value"), 10); ``` +### equal(expression, value) {:#equal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is equal to a constant value. + Signature: ```typescript @@ -3250,25 +2048,30 @@ export declare function equal(expression: Expression, value: unknown): BooleanEx | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the equality comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(expression, values) {:#equalany_7e759b5} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. ```typescript -// Check if the 'category' field is either "Electronics" or value of field 'primaryType' -equalAny(field("category"), [constant("Electronics"), field("primaryType")]); +// Check if the 'age' field is equal to 21 +equal(field("age"), 21); ``` +### equalAny(expression, values) {:#equalany_7e759b5} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or expressions. + Signature: ```typescript @@ -3280,25 +2083,30 @@ export declare function equalAny(expression: Expression, values: ArrayReturns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(expression, arrayExpression) {:#equalany_214ce68} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is equal to any of the provided values. ```typescript -// Check if the 'category' field is set to a value in the disabledCategories field -equalAny(field("category"), field('disabledCategories')); +// Check if the 'category' field is either "Electronics" or value of field 'primaryType' +equalAny(field("category"), [constant("Electronics"), field("primaryType")]); ``` +### equalAny(expression, arrayExpression) {:#equalany_214ce68} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is equal to any of the provided values. + Signature: ```typescript @@ -3310,25 +2118,29 @@ export declare function equalAny(expression: Expression, arrayExpression: Expres | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression whose results to compare. | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for equality to the input. A new representing the 'IN' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for equality to the input. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### exp(expression) {:#exp_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes e to the power of the expression's result. ```typescript -// Compute e to the power of 2. -exp(constant(2)); +// Check if the 'category' field is set to a value in the disabledCategories field +equalAny(field("category"), field('disabledCategories')); ``` - A new representing the exp of the numeric value. + +### exp(expression) {:#exp_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes e to the power of the expression's result. Signature: @@ -3346,19 +2158,24 @@ export declare function exp(expression: Expression): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### greaterThan(expression, value) {:#greaterthan_01df3cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the exp of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is greater than a constant value. ```typescript -// Check if the 'age' field is greater than 18 -greaterThan(field("age"), 18); +// Compute e to the power of 2. +exp(constant(2)); ``` +### greaterThan(expression, value) {:#greaterthan_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is greater than a constant value. + Signature: ```typescript @@ -3370,25 +2187,30 @@ export declare function greaterThan(expression: Expression, value: unknown): Boo | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(expression, value) {:#greaterthanorequal_01df3cf} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is greater than or equal to a constant value. ```typescript -// Check if the 'quantity' field is greater than or equal to 10 -greaterThanOrEqual(field("quantity"), 10); +// Check if the 'age' field is greater than 18 +greaterThan(field("age"), 18); ``` +### greaterThanOrEqual(expression, value) {:#greaterthanorequal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is greater than or equal to a constant value. + Signature: ```typescript @@ -3400,28 +2222,30 @@ export declare function greaterThanOrEqual(expression: Expression, value: unknow | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than or equal to comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### length\_2(expression) {:#length_2_1138a27} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string, array, map, vector, or bytes. ```typescript -// Get the length of the 'name' field. -length(field("name")); - -// Get the number of items in the 'cart' array. -length(field("cart")); +// Check if the 'quantity' field is greater than or equal to 10 +greaterThanOrEqual(field("quantity"), 10); ``` +### length\_2(expression) {:#length_2_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string, array, map, vector, or bytes. + Signature: ```typescript @@ -3432,25 +2256,33 @@ declare function length_2(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a string, array, map, vector, or bytes, which the length will be calculated for. A new Expr representing the length of the string, array, map, vector, or bytes. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a string, array, map, vector, or bytes, which the length will be calculated for. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### lessThan(expression, value) {:#lessthan_01df3cf} +A new `Expression` representing the length of the string, array, map, vector, or bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is less than a constant value. ```typescript -// Check if the 'age' field is less than 30 -lessThan(field("age"), 30); +// Get the length of the 'name' field. +length(field("name")); + +// Get the number of items in the 'cart' array. +length(field("cart")); ``` +### lessThan(expression, value) {:#lessthan_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is less than a constant value. + Signature: ```typescript @@ -3462,25 +2294,30 @@ export declare function lessThan(expression: Expression, value: unknown): Boolea | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(expression, value) {:#lessthanorequal_01df3cf} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is less than or equal to a constant value. ```typescript -// Check if the 'quantity' field is less than or equal to 20 -lessThan(field("quantity"), 20); +// Check if the 'age' field is less than 30 +lessThan(field("age"), 30); ``` +### lessThanOrEqual(expression, value) {:#lessthanorequal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is less than or equal to a constant value. + Signature: ```typescript @@ -3492,25 +2329,30 @@ export declare function lessThanOrEqual(expression: Expression, value: unknown): | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than or equal to comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### ln(expression) {:#ln_1138a27} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the natural logarithm of a numeric value. ```typescript -// Compute the natural logarithm of the 'value' field. -ln(field("value")); +// Check if the 'quantity' field is less than or equal to 20 +lessThan(field("quantity"), 20); ``` +### ln(expression) {:#ln_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the natural logarithm of a numeric value. + Signature: ```typescript @@ -3521,25 +2363,30 @@ export declare function ln(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the natural logarithm will be computed for. A new Expr representing the natural logarithm of the numeric value. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the natural logarithm will be computed for. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### log(expression, base) {:#log_ac183e2} +A new `Expression` representing the natural logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of an expression to a given base. ```typescript -// Compute the logarithm of the 'value' field with base 10. -log(field("value"), 10); +// Compute the natural logarithm of the 'value' field. +ln(field("value")); ``` +### log(expression, base) {:#log_ac183e2} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of an expression to a given base. + Signature: ```typescript @@ -3551,25 +2398,30 @@ export declare function log(expression: Expression, base: number): FunctionExpre | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the logarithm will be computed for. | -| base | number | The base of the logarithm. A new representing the logarithm of the numeric value. | +| base | number | The base of the logarithm. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### log(expression, base) {:#log_1894737} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of an expression to a given base. ```typescript -// Compute the logarithm of the 'value' field with the base in the 'base' field. -log(field("value"), field("base")); +// Compute the logarithm of the 'value' field with base 10. +log(field("value"), 10); ``` +### log(expression, base) {:#log_1894737} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of an expression to a given base. + Signature: ```typescript @@ -3581,25 +2433,30 @@ export declare function log(expression: Expression, base: Expression): FunctionE | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the logarithm will be computed for. | -| base | [Expression](./firestore_pipelines.expression.md#expression_class) | The base of the logarithm. A new representing the logarithm of the numeric value. | +| base | [Expression](./firestore_pipelines.expression.md#expression_class) | The base of the logarithm. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### log10(expression) {:#log10_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the base-10 logarithm of a numeric value. ```typescript -// Compute the base-10 logarithm of the 'value' field. -log10(field("value")); +// Compute the logarithm of the 'value' field with the base in the 'base' field. +log(field("value"), field("base")); ``` +### log10(expression) {:#log10_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the base-10 logarithm of a numeric value. + Signature: ```typescript @@ -3610,11 +2467,22 @@ export declare function log10(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the base-10 logarithm will be computed for. A new Expr representing the base-10 logarithm of the numeric value. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the base-10 logarithm will be computed for. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new `Expression` representing the base-10 logarithm of the numeric value. + +### Example + + +```typescript +// Compute the base-10 logarithm of the 'value' field. +log10(field("value")); + +``` ### maximum(expression) {:#maximum_1138a27} @@ -3623,12 +2491,6 @@ export declare function log10(expression: Expression): FunctionExpression; Creates an aggregation that finds the maximum value of an expression across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -maximum(field("score")).as("highestScore"); - -``` - Signature: ```typescript @@ -3639,25 +2501,30 @@ export declare function maximum(expression: Expression): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to find the maximum value of. A new representing the 'maximum' aggregation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to find the maximum value of. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### minimum(expression) {:#minimum_1138a27} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'maximum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. ```typescript -// Find the lowest price of all products -minimum(field("price")).as("lowestPrice"); +// Find the highest score in a leaderboard +maximum(field("score")).as("highestScore"); ``` +### minimum(expression) {:#minimum_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the minimum value of an expression across multiple stage inputs. + Signature: ```typescript @@ -3668,25 +2535,30 @@ export declare function minimum(expression: Expression): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to find the minimum value of. A new representing the 'minimum' aggregation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to find the minimum value of. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### mod(expression, value) {:#mod_01df3cf} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'minimum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. ```typescript -// Calculate the remainder of dividing 'field1' by 5. -mod(field("field1"), 5); +// Find the lowest price of all products +minimum(field("price")).as("lowestPrice"); ``` +### mod(expression, value) {:#mod_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. + Signature: ```typescript @@ -3698,25 +2570,30 @@ export declare function mod(expression: Expression, value: unknown): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The dividend expression. | -| value | unknown | The divisor constant. A new representing the modulo operation. | +| value | unknown | The divisor constant. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### notEqual(expression, value) {:#notequal_01df3cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if an expression is not equal to a constant value. ```typescript -// Check if the 'status' field is not equal to "completed" -notEqual(field("status"), "completed"); +// Calculate the remainder of dividing 'field1' by 5. +mod(field("field1"), 5); ``` +### notEqual(expression, value) {:#notequal_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if an expression is not equal to a constant value. + Signature: ```typescript @@ -3728,25 +2605,30 @@ export declare function notEqual(expression: Expression, value: unknown): Boolea | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the inequality comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### round(expression) {:#round_1138a27} +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the nearest whole number. ```typescript -// Round the value of the 'price' field. -round(field("price")); +// Check if the 'status' field is not equal to "completed" +notEqual(field("status"), "completed"); ``` +### round(expression) {:#round_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the nearest whole number. + Signature: ```typescript @@ -3757,25 +2639,30 @@ export declare function round(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which will be rounded. A new Expr representing the rounded value. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which will be rounded. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### round(expression, decimalPlaces) {:#round_a3a92d0} +A new `Expression` representing the rounded value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the specified number of decimal places. ```typescript -// Round the value of the 'price' field to two decimal places. -round(field("price"), constant(2)); +// Round the value of the 'price' field. +round(field("price")); ``` +### round(expression, decimalPlaces) {:#round_a3a92d0} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the specified number of decimal places. + Signature: ```typescript @@ -3787,12 +2674,23 @@ export declare function round(expression: Expression, decimalPlaces: number | Ex | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which will be rounded. | -| decimalPlaces | number \| [Expression](./firestore_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | number \| [Expression](./firestore_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the rounded value. + +### Example + + +```typescript +// Round the value of the 'price' field to two decimal places. +round(field("price"), constant(2)); + +``` + ### split(expression, delimiter) {:#split_5b5612b} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3811,12 +2709,14 @@ export declare function split(expression: Expression, delimiter: string): Functi | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | Split the result of this expression. | -| delimiter | string | Split on this delimiter. A new representing the split function. | +| delimiter | string | Split on this delimiter. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3844,12 +2744,14 @@ export declare function split(expression: Expression, delimiter: Expression): Fu | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | Split the result of this expression. | -| delimiter | [Expression](./firestore_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. A new representing the split function. | +| delimiter | [Expression](./firestore_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -3866,12 +2768,6 @@ split(field('scores'), conditional(field('format').equal('csv'), constant(','), Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt(field("value")); - -``` - Signature: ```typescript @@ -3882,25 +2778,30 @@ export declare function sqrt(expression: Expression): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the square root will be computed for. A new representing the square root of the numeric value. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a numeric value, which the square root will be computed for. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### subtract(expression, value) {:#subtract_01df3cf} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the square root of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a constant value from an expression. ```typescript -// Subtract the constant value 2 from the 'value' field -subtract(field("value"), 2); +// Compute the square root of the 'value' field. +sqrt(field("value")); ``` +### subtract(expression, value) {:#subtract_01df3cf} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a constant value from an expression. + Signature: ```typescript @@ -3912,25 +2813,30 @@ export declare function subtract(expression: Expression, value: unknown): Functi | Parameter | Type | Description | | --- | --- | --- | | expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract from. | -| value | unknown | The constant value to subtract. A new representing the subtraction operation. | +| value | unknown | The constant value to subtract. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### sum(expression) {:#sum_1138a27} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. ```typescript -// Calculate the total revenue from a set of orders -sum(field("orderAmount")).as("totalRevenue"); +// Subtract the constant value 2 from the 'value' field +subtract(field("value"), 2); ``` +### sum(expression) {:#sum_1138a27} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the sum of values from an expression across multiple stage inputs. + Signature: ```typescript @@ -3941,12 +2847,23 @@ export declare function sum(expression: Expression): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to sum up. A new representing the 'sum' aggregation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to sum up. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'sum' aggregation. + +### Example + + +```typescript +// Calculate the total revenue from a set of orders +sum(field("orderAmount")).as("totalRevenue"); + +``` + ### type(expression) {:#type_1138a27} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -3970,6 +2887,8 @@ export declare function type(expression: Expression): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the data type. + ### Example @@ -3978,7 +2897,6 @@ export declare function type(expression: Expression): FunctionExpression; type(conditional(exists('foo'), constant(1), constant(true))) ``` - A new {Expression} representing the data type. ## function(field, ...) @@ -3989,12 +2907,6 @@ type(conditional(exists('foo'), constant(1), constant(true))) Creates an expression that returns `true` if a field is absent. Otherwise, returns `false` even if the field value is `null`. -```typescript -// Check if the field `value` is absent. -isAbsent("value"); - -``` - Signature: ```typescript @@ -4005,25 +2917,30 @@ export declare function isAbsent(field: string): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| field | string | The field to check. A new representing the 'isAbsent' check. | +| field | string | The field to check. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### reverse(field) {:#reverse_0fb8cd4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'isAbsent' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string value in the specified field. ```typescript -// Reverse the value of the 'myString' field. -reverse("myString"); +// Check if the field `value` is absent. +isAbsent("value"); ``` +### reverse(field) {:#reverse_0fb8cd4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string value in the specified field. + Signature: ```typescript @@ -4034,25 +2951,30 @@ export declare function reverse(field: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| field | string | The name of the field representing the string to reverse. A new representing the reversed string. | +| field | string | The name of the field representing the string to reverse. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### stringReverse(field) {:#stringreverse_0fb8cd4} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string value in the specified field. ```typescript // Reverse the value of the 'myString' field. -strReverse("myString"); +reverse("myString"); ``` +### stringReverse(field) {:#stringreverse_0fb8cd4} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string value in the specified field. + Signature: ```typescript @@ -4063,12 +2985,23 @@ export declare function stringReverse(field: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| field | string | The name of the field representing the string to reverse. A new representing the reversed string. | +| field | string | The name of the field representing the string to reverse. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. + +### Example + + +```typescript +// Reverse the value of the 'myString' field. +strReverse("myString"); + +``` + ### substring(field, position, length) {:#substring_0d9573a} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -4138,12 +3071,14 @@ export declare function abs(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to compute the absolute value of. A new representing the absolute value of the numeric value. | +| fieldName | string | The field to compute the absolute value of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the absolute value of the numeric value. + ### add(fieldName, second) {:#add_b75bb8b} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -4151,12 +3086,6 @@ export declare function abs(fieldName: string): FunctionExpression; Creates an expression that adds a field's value to an expression. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -add("quantity", field("reserve")); - -``` - Signature: ```typescript @@ -4174,6 +3103,17 @@ export declare function add(fieldName: string, second: Expression | unknown): Fu [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the addition operation. + +### Example + + +```typescript +// Add the value of the 'quantity' field and the 'reserve' field. +add("quantity", field("reserve")); + +``` + ### arrayContains(fieldName, element) {:#arraycontains_aaace4a} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -4181,16 +3121,45 @@ export declare function add(fieldName: string, second: Expression | unknown): Fu Creates an expression that checks if a field's array value contains a specific element. +Signature: + +```typescript +export declare function arrayContains(fieldName: string, element: Expression): BooleanExpression; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | The field name to check. | +| element | [Expression](./firestore_pipelines.expression.md#expression_class) | The element to search for in the array. | + +Returns: + +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. + +### Example + + ```typescript // Check if the 'colors' array contains the value of field 'selectedColor' arrayContains("colors", field("selectedColor")); ``` +### arrayContains(fieldName, element) {:#arraycontains_999590f} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains a specific value. + Signature: ```typescript -export declare function arrayContains(fieldName: string, element: Expression): BooleanExpression; +export declare function arrayContains(fieldName: string, element: unknown): BooleanExpression; ``` #### Parameters @@ -4198,29 +3167,34 @@ export declare function arrayContains(fieldName: string, element: Expression): B | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| element | [Expression](./firestore_pipelines.expression.md#expression_class) | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| element | unknown | The element to search for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContains(fieldName, element) {:#arraycontains_999590f} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains a specific value. ```typescript // Check if the 'colors' array contains "red" arrayContains("colors", "red"); -``` +``` + +### arrayContainsAll(fieldName, values) {:#arraycontainsall_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains all the specified values or expressions. Signature: ```typescript -export declare function arrayContains(fieldName: string, element: unknown): BooleanExpression; +export declare function arrayContainsAll(fieldName: string, values: Array): BooleanExpression; ``` #### Parameters @@ -4228,18 +3202,16 @@ export declare function arrayContains(fieldName: string, element: unknown): Bool | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| element | unknown | The element to search for in the array. A new representing the 'array\_contains' comparison. | +| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(fieldName, values) {:#arraycontainsall_8060b23} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains all the specified values or expressions. ```typescript // Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" @@ -4247,10 +3219,17 @@ arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); ``` +### arrayContainsAll(fieldName, arrayExpression) {:#arraycontainsall_48da8d9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains all the specified values or expressions. + Signature: ```typescript -export declare function arrayContainsAll(fieldName: string, values: Array): BooleanExpression; +export declare function arrayContainsAll(fieldName: string, arrayExpression: Expression): BooleanExpression; ``` #### Parameters @@ -4258,18 +3237,16 @@ export declare function arrayContainsAll(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAll(fieldName, arrayExpression) {:#arraycontainsall_48da8d9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_all' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains all the specified values or expressions. ```typescript // Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" @@ -4277,10 +3254,17 @@ arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); ``` +### arrayContainsAny(fieldName, values) {:#arraycontainsany_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains any of the specified elements. + Signature: ```typescript -export declare function arrayContainsAll(fieldName: string, arrayExpression: Expression): BooleanExpression; +export declare function arrayContainsAny(fieldName: string, values: Array): BooleanExpression; ``` #### Parameters @@ -4288,18 +3272,16 @@ export declare function arrayContainsAll(fieldName: string, arrayExpression: Exp | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The elements to check for in the array. A new representing the 'array\_contains\_all' comparison. | +| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The elements to check for in the array. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(fieldName, values) {:#arraycontainsany_8060b23} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains any of the specified elements. ```typescript // Check if the 'groups' array contains either the value from the 'userGroup' field @@ -4308,10 +3290,17 @@ arrayContainsAny("categories", [field("cate1"), "Science"]); ``` +### arrayContainsAny(fieldName, values) {:#arraycontainsany_1b4f7cd} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's array value contains any of the specified elements. + Signature: ```typescript -export declare function arrayContainsAny(fieldName: string, values: Array): BooleanExpression; +export declare function arrayContainsAny(fieldName: string, values: Expression): BooleanExpression; ``` #### Parameters @@ -4319,18 +3308,16 @@ export declare function arrayContainsAny(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### arrayContainsAny(fieldName, values) {:#arraycontainsany_1b4f7cd} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'array\_contains\_any' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's array value contains any of the specified elements. ```typescript // Check if the 'groups' array contains either the value from the 'userGroup' field @@ -4339,29 +3326,33 @@ arrayContainsAny("categories", array([field("cate1"), "Science"])); ``` +### arrayLength(fieldName) {:#arraylength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of an array in a specified field. + Signature: ```typescript -export declare function arrayContainsAny(fieldName: string, values: Expression): BooleanExpression; +export declare function arrayLength(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to check. | -| values | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for in the array field. A new representing the 'array\_contains\_any' comparison. | +| fieldName | string | The name of the field containing an array to calculate the length of. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### arrayLength(fieldName) {:#arraylength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of an array in a specified field. ```typescript // Get the number of items in field 'cart' @@ -4369,28 +3360,33 @@ arrayLength('cart'); ``` +### arraySum(fieldName) {:#arraysum_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the sum of the elements in an array. + Signature: ```typescript -export declare function arrayLength(fieldName: string): FunctionExpression; +export declare function arraySum(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing an array to calculate the length of. A new representing the length of the array. | +| fieldName | string | The name of the field to compute the sum of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### arraySum(fieldName) {:#arraysum_e5b0480} +A new `Expression` representing the sum of the elements in the array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the sum of the elements in an array. ```typescript // Compute the sum of the elements in the 'scores' field. @@ -4398,28 +3394,33 @@ arraySum("scores"); ``` +### ascending(fieldName) {:#ascending_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in ascending order based on a field. + Signature: ```typescript -export declare function arraySum(fieldName: string): FunctionExpression; +export declare function ascending(fieldName: string): Ordering; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the sum of. A new Expr representing the sum of the elements in the array. | +| fieldName | string | The field to create an ascending ordering for. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[Ordering](./firestore_pipelines.ordering.md#ordering_class) -### ascending(fieldName) {:#ascending_e5b0480} +A new `Ordering` for ascending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an that sorts documents in ascending order based on a field. ```typescript // Sort documents by the 'name' field in ascending order @@ -4428,28 +3429,33 @@ firestore.pipeline().collection("users") ``` +### average(fieldName) {:#average_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. + Signature: ```typescript -export declare function ascending(fieldName: string): Ordering; +export declare function average(fieldName: string): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to create an ascending ordering for. A new Ordering for ascending sorting. | +| fieldName | string | The name of the field containing numeric values to average. | Returns: -[Ordering](./firestore_pipelines.ordering.md#ordering_class) +[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### average(fieldName) {:#average_e5b0480} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'average' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the average (mean) of a field's values across multiple stage inputs. ```typescript // Calculate the average age of users @@ -4457,28 +3463,33 @@ average("age").as("averageAge"); ``` +### byteLength(fieldName) {:#bytelength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. + Signature: ```typescript -export declare function average(fieldName: string): AggregateFunction; +export declare function byteLength(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing numeric values to average. A new representing the 'average' aggregation. | +| fieldName | string | The name of the field containing the string. | Returns: -[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### byteLength(fieldName) {:#bytelength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string in bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. ```typescript // Calculate the length of the 'myString' field in bytes. @@ -4486,28 +3497,33 @@ byteLength("myString"); ``` +### ceil(fieldName) {:#ceil_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the ceiling of a numeric value. + Signature: ```typescript -export declare function byteLength(fieldName: string): FunctionExpression; +export declare function ceil(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the length of the string in bytes. | +| fieldName | string | The name of the field to compute the ceiling of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### ceil(fieldName) {:#ceil_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the ceiling of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the ceiling of a numeric value. ```typescript // Compute the ceiling of the 'price' field. @@ -4515,28 +3531,33 @@ ceil("price"); ``` +### charLength(fieldName) {:#charlength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the character length of a string field in UTF8. + Signature: ```typescript -export declare function ceil(fieldName: string): FunctionExpression; +export declare function charLength(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the ceiling of. A new representing the ceiling of the numeric value. | +| fieldName | string | The name of the field containing the string. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### charLength(fieldName) {:#charlength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the character length of a string field in UTF8. ```typescript // Get the character length of the 'name' field in UTF-8. @@ -4544,28 +3565,33 @@ strLength("name"); ``` +### collectionId(fieldName) {:#collectionid_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the collection ID from a path. + Signature: ```typescript -export declare function charLength(fieldName: string): FunctionExpression; +export declare function collectionId(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the length of the string. | +| fieldName | string | The name of the field to get the collection ID from. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### collectionId(fieldName) {:#collectionid_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the collectionId operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the collection ID from a path. ```typescript // Get the collection ID from a path. @@ -4573,28 +3599,35 @@ collectionId("__name__"); ``` +### concat(fieldName, second, others) {:#concat_828272e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. + Signature: ```typescript -export declare function collectionId(fieldName: string): FunctionExpression; +export declare function concat(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to get the collection ID from. A new representing the collectionId operation. | +| fieldName | string | The name of a field to concatenate. | +| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second literal or expression to concatenate. | +| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Additional literal or expressions to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### concat(fieldName, second, others) {:#concat_828272e} +A new `Expression` representing the concatenation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. ```typescript // Concatenate a field with a literal string. @@ -4602,30 +3635,34 @@ concat(field("firstName"), "Doe") ``` +### cosineDistance(fieldName, vector) {:#cosinedistance_463a23e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between a field's vector value and a literal vector value. + Signature: ```typescript -export declare function concat(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; +export declare function cosineDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of a field to concatenate. | -| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second literal or expression to concatenate. | -| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Additional literal or expressions to concatenate. A new Expression representing the concatenation. | +| fieldName | string | The name of the field containing the first vector. | +| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles) or [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### cosineDistance(fieldName, vector) {:#cosinedistance_463a23e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between a field's vector value and a literal vector value. ```typescript // Calculate the Cosine distance between the 'location' field and a target location @@ -4633,10 +3670,17 @@ cosineDistance("location", [37.7749, -122.4194]); ``` +### cosineDistance(fieldName, vectorExpression) {:#cosinedistance_ed766a1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between a field's vector value and a vector expression. + Signature: ```typescript -export declare function cosineDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; +export declare function cosineDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; ``` #### Parameters @@ -4644,18 +3688,16 @@ export declare function cosineDistance(fieldName: string, vector: number[] | Vec | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the first vector. | -| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles) or [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) to compare against. A new representing the Cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### cosineDistance(fieldName, vectorExpression) {:#cosinedistance_ed766a1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between a field's vector value and a vector expression. ```typescript // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field @@ -4663,29 +3705,33 @@ cosineDistance("userVector", field("itemVector")); ``` +### count(fieldName) {:#count_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that counts the number of stage inputs where the input field exists. + Signature: ```typescript -export declare function cosineDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; +export declare function count(fieldName: string): AggregateFunction; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the first vector. | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the cosine distance between the two vectors. | +| fieldName | string | The name of the field to count. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### count(fieldName) {:#count_e5b0480} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'count' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that counts the number of stage inputs where the input field exists. ```typescript // Count the total number of products @@ -4693,28 +3739,33 @@ count("productId").as("totalProducts"); ``` +### descending(fieldName) {:#descending_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an [Ordering](./firestore_pipelines.ordering.md#ordering_class) that sorts documents in descending order based on a field. + Signature: ```typescript -export declare function count(fieldName: string): AggregateFunction; +export declare function descending(fieldName: string): Ordering; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to count. A new representing the 'count' aggregation. | +| fieldName | string | The field to create a descending ordering for. | Returns: -[AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) +[Ordering](./firestore_pipelines.ordering.md#ordering_class) -### descending(fieldName) {:#descending_e5b0480} +A new `Ordering` for descending sorting. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an that sorts documents in descending order based on a field. ```typescript // Sort documents by the 'name' field in descending order @@ -4723,28 +3774,34 @@ firestore.pipeline().collection("users") ``` +### divide(fieldName, expressions) {:#divide_cf36e43} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides a field's value by an expression. + Signature: ```typescript -export declare function descending(fieldName: string): Ordering; +export declare function divide(fieldName: string, expressions: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to create a descending ordering for. A new Ordering for descending sorting. | +| fieldName | string | The field name to be divided. | +| expressions | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. | Returns: -[Ordering](./firestore_pipelines.ordering.md#ordering_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### divide(fieldName, expressions) {:#divide_cf36e43} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides a field's value by an expression. ```typescript // Divide the 'total' field by the 'count' field @@ -4752,10 +3809,17 @@ divide("total", field("count")); ``` +### divide(fieldName, value) {:#divide_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that divides a field's value by a constant value. + Signature: ```typescript -export declare function divide(fieldName: string, expressions: Expression): FunctionExpression; +export declare function divide(fieldName: string, value: unknown): FunctionExpression; ``` #### Parameters @@ -4763,18 +3827,16 @@ export declare function divide(fieldName: string, expressions: Expression): Func | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to be divided. | -| expressions | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. A new representing the division operation. | +| value | unknown | The constant value to divide by. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### divide(fieldName, value) {:#divide_65e2f32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that divides a field's value by a constant value. ```typescript // Divide the 'value' field by 10 @@ -4782,29 +3844,34 @@ divide("value", 10); ``` +### dotProduct(fieldName, vector) {:#dotproduct_463a23e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between a field's vector value and a double array. + Signature: ```typescript -export declare function divide(fieldName: string, value: unknown): FunctionExpression; +export declare function dotProduct(fieldName: string, vector: number[] | VectorValue): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to be divided. | -| value | unknown | The constant value to divide by. A new representing the division operation. | +| fieldName | string | The name of the field containing the first vector. | +| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(fieldName, vector) {:#dotproduct_463a23e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between a field's vector value and a double array. ```typescript // Calculate the dot product distance between a feature vector and a target vector @@ -4812,10 +3879,17 @@ dotProduct("features", [0.5, 0.8, 0.2]); ``` +### dotProduct(fieldName, vectorExpression) {:#dotproduct_ed766a1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between a field's vector value and a vector expression. + Signature: ```typescript -export declare function dotProduct(fieldName: string, vector: number[] | VectorValue): FunctionExpression; +export declare function dotProduct(fieldName: string, vectorExpression: Expression): FunctionExpression; ``` #### Parameters @@ -4823,18 +3897,16 @@ export declare function dotProduct(fieldName: string, vector: number[] | VectorV | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the first vector. | -| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. A new representing the dot product between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to calculate with. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(fieldName, vectorExpression) {:#dotproduct_ed766a1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between a field's vector value and a vector expression. ```typescript // Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2' @@ -4842,29 +3914,34 @@ dotProduct("docVector1", field("docVector2")); ``` +### endsWith(fieldName, suffix) {:#endswith_05ca3b0} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value ends with a given postfix. + Signature: ```typescript -export declare function dotProduct(fieldName: string, vectorExpression: Expression): FunctionExpression; +export declare function endsWith(fieldName: string, suffix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the first vector. | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to calculate with. A new representing the dot product between the two vectors. | +| fieldName | string | The field name to check. | +| suffix | string | The postfix to check for. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(fieldName, suffix) {:#endswith_05ca3b0} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value ends with a given postfix. ```typescript // Check if the 'filename' field ends with ".txt" @@ -4872,10 +3949,17 @@ endsWith("filename", ".txt"); ``` +### endsWith(fieldName, suffix) {:#endswith_8fc0ebc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value ends with a given postfix. + Signature: ```typescript -export declare function endsWith(fieldName: string, suffix: string): BooleanExpression; +export declare function endsWith(fieldName: string, suffix: Expression): BooleanExpression; ``` #### Parameters @@ -4883,18 +3967,16 @@ export declare function endsWith(fieldName: string, suffix: string): BooleanExpr | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| suffix | string | The postfix to check for. A new representing the 'ends with' comparison. | +| suffix | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the postfix. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(fieldName, suffix) {:#endswith_8fc0ebc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value ends with a given postfix. ```typescript // Check if the 'url' field ends with the value of the 'extension' field @@ -4902,29 +3984,34 @@ endsWith("url", field("extension")); ``` +### equal(fieldName, expression) {:#equal_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to an expression. + Signature: ```typescript -export declare function endsWith(fieldName: string, suffix: Expression): BooleanExpression; +export declare function equal(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to check. | -| suffix | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the postfix. A new representing the 'ends with' comparison. | +| fieldName | string | The field name to compare. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### equal(fieldName, expression) {:#equal_1e91657} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to an expression. ```typescript // Check if the 'age' field is equal to the 'limit' field @@ -4932,10 +4019,17 @@ equal("age", field("limit")); ``` +### equal(fieldName, value) {:#equal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to a constant value. + Signature: ```typescript -export declare function equal(fieldName: string, expression: Expression): BooleanExpression; +export declare function equal(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -4943,18 +4037,16 @@ export declare function equal(fieldName: string, expression: Expression): Boolea | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the equality comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### equal(fieldName, value) {:#equal_65e2f32} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to a constant value. ```typescript // Check if the 'city' field is equal to string constant "London" @@ -4962,29 +4054,34 @@ equal("city", "London"); ``` +### equalAny(fieldName, values) {:#equalany_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to any of the provided values or expressions. + Signature: ```typescript -export declare function equal(fieldName: string, value: unknown): BooleanExpression; +export declare function equalAny(fieldName: string, values: Array): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the equality comparison. | +| fieldName | string | The field to compare. | +| values | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | The values to check against. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(fieldName, values) {:#equalany_8060b23} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -4992,10 +4089,17 @@ equalAny("category", [constant("Electronics"), field("primaryType")]); ``` +### equalAny(fieldName, arrayExpression) {:#equalany_48da8d9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is equal to any of the provided values or expressions. + Signature: ```typescript -export declare function equalAny(fieldName: string, values: Array): BooleanExpression; +export declare function equalAny(fieldName: string, arrayExpression: Expression): BooleanExpression; ``` #### Parameters @@ -5003,18 +4107,16 @@ export declare function equalAny(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### equalAny(fieldName, arrayExpression) {:#equalany_48da8d9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is equal to any of the provided values or expressions. ```typescript // Check if the 'category' field is either "Electronics" or value of field 'primaryType' @@ -5022,29 +4124,34 @@ equalAny("category", ["Electronics", field("primaryType")]); ``` +### euclideanDistance(fieldName, vector) {:#euclideandistance_463a23e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between a field's vector value and a double array. + Signature: ```typescript -export declare function equalAny(fieldName: string, arrayExpression: Expression): BooleanExpression; +export declare function euclideanDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field to compare. | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression that evaluates to an array, whose elements to check for equality to the input field. A new representing the 'IN' comparison. | +| fieldName | string | The name of the field containing the first vector. | +| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(fieldName, vector) {:#euclideandistance_463a23e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between a field's vector value and a double array. ```typescript // Calculate the Euclidean distance between the 'location' field and a target location @@ -5052,10 +4159,17 @@ euclideanDistance("location", [37.7749, -122.4194]); ``` +### euclideanDistance(fieldName, vectorExpression) {:#euclideandistance_ed766a1} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between a field's vector value and a vector expression. + Signature: ```typescript -export declare function euclideanDistance(fieldName: string, vector: number[] | VectorValue): FunctionExpression; +export declare function euclideanDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; ``` #### Parameters @@ -5063,18 +4177,16 @@ export declare function euclideanDistance(fieldName: string, vector: number[] | | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the first vector. | -| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. A new representing the Euclidean distance between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(fieldName, vectorExpression) {:#euclideandistance_ed766a1} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between a field's vector value and a vector expression. ```typescript // Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' @@ -5082,29 +4194,33 @@ euclideanDistance("pointA", field("pointB")); ``` +### exists(fieldName) {:#exists_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field exists. + Signature: ```typescript -export declare function euclideanDistance(fieldName: string, vectorExpression: Expression): FunctionExpression; +export declare function exists(fieldName: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the first vector. | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the Euclidean distance between the two vectors. | +| fieldName | string | The field name to check. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### exists(fieldName) {:#exists_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'exists' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field exists. ```typescript // Check if the document has a field named "phoneNumber" @@ -5112,81 +4228,93 @@ exists("phoneNumber"); ``` +### exp(fieldName) {:#exp_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes e to the power of the expression's result. + Signature: ```typescript -export declare function exists(fieldName: string): BooleanExpression; +export declare function exp(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to check. A new representing the 'exists' check. | +| fieldName | string | | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### exp(fieldName) {:#exp_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the exp of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes e to the power of the expression's result. ```typescript // Compute e to the power of the 'value' field. exp('value'); ``` - A new representing the exp of the numeric value. + +### floor(fieldName) {:#floor_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the floor of a numeric value. Signature: ```typescript -export declare function exp(fieldName: string): FunctionExpression; +export declare function floor(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | | +| fieldName | string | The name of the field to compute the floor of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### floor(fieldName) {:#floor_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the floor of the numeric value. + +### greaterThan(fieldName, expression) {:#greaterthan_1e91657} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates an expression that computes the floor of a numeric value. +Creates an expression that checks if a field's value is greater than an expression. Signature: ```typescript -export declare function floor(fieldName: string): FunctionExpression; +export declare function greaterThan(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the floor of. A new representing the floor of the numeric value. | +| fieldName | string | The field name to compare. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThan(fieldName, expression) {:#greaterthan_1e91657} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than an expression. ```typescript // Check if the value of field 'age' is greater than the value of field 'limit' @@ -5194,10 +4322,17 @@ greaterThan("age", field("limit")); ``` +### greaterThan(fieldName, value) {:#greaterthan_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is greater than a constant value. + Signature: ```typescript -export declare function greaterThan(fieldName: string, expression: Expression): BooleanExpression; +export declare function greaterThan(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5205,29 +4340,34 @@ export declare function greaterThan(fieldName: string, expression: Expression): | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the greater than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThan(fieldName, value) {:#greaterthan_65e2f32} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than a constant value. ```typescript // Check if the 'price' field is greater than 100 greaterThan("price", 100); -``` +``` + +### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_2e16acb} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is greater than or equal to an expression. Signature: ```typescript -export declare function greaterThan(fieldName: string, value: unknown): BooleanExpression; +export declare function greaterThanOrEqual(fieldName: string, value: Expression): BooleanExpression; ``` #### Parameters @@ -5235,18 +4375,16 @@ export declare function greaterThan(fieldName: string, value: unknown): BooleanE | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than comparison. | +| value | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_2e16acb} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than or equal to an expression. ```typescript // Check if the value of field 'age' is greater than or equal to the value of field 'limit' @@ -5254,10 +4392,17 @@ greaterThanOrEqual("age", field("limit")); ``` +### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is greater than or equal to a constant value. + Signature: ```typescript -export declare function greaterThanOrEqual(fieldName: string, value: Expression): BooleanExpression; +export declare function greaterThanOrEqual(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5265,18 +4410,16 @@ export declare function greaterThanOrEqual(fieldName: string, value: Expression) | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the greater than or equal to comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(fieldName, value) {:#greaterthanorequal_65e2f32} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is greater than or equal to a constant value. ```typescript // Check if the 'score' field is greater than or equal to 80 @@ -5284,29 +4427,33 @@ greaterThanOrEqual("score", 80); ``` +### length\_2(fieldName) {:#length_2_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a string, array, map, vector, or bytes. + Signature: ```typescript -export declare function greaterThanOrEqual(fieldName: string, value: unknown): BooleanExpression; +declare function length_2(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the greater than or equal to comparison. | +| fieldName | string | The name of the field to calculate the length of. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### length\_2(fieldName) {:#length_2_e5b0480} +A new `Expression` representing the length of the string, array, map, vector, or bytes. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a string, array, map, vector, or bytes. ```typescript // Get the length of the 'name' field. @@ -5317,28 +4464,34 @@ length("cart"); ``` +### lessThan(fieldName, expression) {:#lessthan_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than an expression. + Signature: ```typescript -declare function length_2(fieldName: string): FunctionExpression; +export declare function lessThan(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to calculate the length of. A new Expr representing the length of the string, array, map, vector, or bytes. | +| fieldName | string | The field name to compare. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### lessThan(fieldName, expression) {:#lessthan_1e91657} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than an expression. ```typescript // Check if the 'age' field is less than the 'limit' field @@ -5346,10 +4499,17 @@ lessThan("age", field("limit")); ``` +### lessThan(fieldName, value) {:#lessthan_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than a constant value. + Signature: ```typescript -export declare function lessThan(fieldName: string, expression: Expression): BooleanExpression; +export declare function lessThan(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5357,18 +4517,16 @@ export declare function lessThan(fieldName: string, expression: Expression): Boo | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the less than comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### lessThan(fieldName, value) {:#lessthan_65e2f32} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than a constant value. ```typescript // Check if the 'price' field is less than 50 @@ -5376,10 +4534,17 @@ lessThan("price", 50); ``` +### lessThanOrEqual(fieldName, expression) {:#lessthanorequal_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than or equal to an expression. + Signature: ```typescript -export declare function lessThan(fieldName: string, value: unknown): BooleanExpression; +export declare function lessThanOrEqual(fieldName: string, expression: Expression): BooleanExpression; ``` #### Parameters @@ -5387,18 +4552,16 @@ export declare function lessThan(fieldName: string, value: unknown): BooleanExpr | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than comparison. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(fieldName, expression) {:#lessthanorequal_1e91657} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than or equal to an expression. ```typescript // Check if the 'quantity' field is less than or equal to the 'limit' field @@ -5406,10 +4569,17 @@ lessThan("quantity", field("limit")); ``` +### lessThanOrEqual(fieldName, value) {:#lessthanorequal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is less than or equal to a constant value. + Signature: ```typescript -export declare function lessThanOrEqual(fieldName: string, expression: Expression): BooleanExpression; +export declare function lessThanOrEqual(fieldName: string, value: unknown): BooleanExpression; ``` #### Parameters @@ -5417,18 +4587,16 @@ export declare function lessThanOrEqual(fieldName: string, expression: Expressio | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the less than or equal to comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(fieldName, value) {:#lessthanorequal_65e2f32} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is less than or equal to a constant value. ```typescript // Check if the 'score' field is less than or equal to 70 @@ -5436,29 +4604,34 @@ lessThan("score", 70); ``` +### like(fieldName, pattern) {:#like_67f7432} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison against a field. + Signature: ```typescript -export declare function lessThanOrEqual(fieldName: string, value: unknown): BooleanExpression; +export declare function like(fieldName: string, pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the less than or equal to comparison. | +| fieldName | string | The name of the field containing the string. | +| pattern | string | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### like(fieldName, pattern) {:#like_67f7432} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison against a field. ```typescript // Check if the 'title' field contains the string "guide" @@ -5466,10 +4639,17 @@ like("title", "%guide%"); ``` +### like(fieldName, pattern) {:#like_cb1318d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison against a field. + Signature: ```typescript -export declare function like(fieldName: string, pattern: string): BooleanExpression; +export declare function like(fieldName: string, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -5477,18 +4657,16 @@ export declare function like(fieldName: string, pattern: string): BooleanExpress | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | string | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### like(fieldName, pattern) {:#like_cb1318d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison against a field. ```typescript // Check if the 'title' field contains the string "guide" @@ -5496,29 +4674,33 @@ like("title", field("pattern")); ``` +### ln(fieldName) {:#ln_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the natural logarithm of a numeric value. + Signature: ```typescript -export declare function like(fieldName: string, pattern: Expression): BooleanExpression; +export declare function ln(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| fieldName | string | The name of the field to compute the natural logarithm of. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### ln(fieldName) {:#ln_e5b0480} +A new `Expression` representing the natural logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the natural logarithm of a numeric value. ```typescript // Compute the natural logarithm of the 'value' field. @@ -5526,28 +4708,34 @@ ln("value"); ``` +### log(fieldName, base) {:#log_a89e21b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of a field to a given base. + Signature: ```typescript -export declare function ln(fieldName: string): FunctionExpression; +export declare function log(fieldName: string, base: number): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the natural logarithm of. A new Expr representing the natural logarithm of the numeric value. | +| fieldName | string | The name of the field to compute the logarithm of. | +| base | number | The base of the logarithm. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### log(fieldName, base) {:#log_a89e21b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of a field to a given base. ```typescript // Compute the logarithm of the 'value' field with base 10. @@ -5555,10 +4743,17 @@ log("value", 10); ``` +### log(fieldName, base) {:#log_805b11f} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the logarithm of a field to a given base. + Signature: ```typescript -export declare function log(fieldName: string, base: number): FunctionExpression; +export declare function log(fieldName: string, base: Expression): FunctionExpression; ``` #### Parameters @@ -5566,18 +4761,16 @@ export declare function log(fieldName: string, base: number): FunctionExpression | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field to compute the logarithm of. | -| base | number | The base of the logarithm. A new representing the logarithm of the numeric value. | +| base | [Expression](./firestore_pipelines.expression.md#expression_class) | The base of the logarithm. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### log(fieldName, base) {:#log_805b11f} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the logarithm of a field to a given base. ```typescript // Compute the logarithm of the 'value' field with the base in the 'base' field. @@ -5585,29 +4778,33 @@ log("value", field("base")); ``` +### log10(fieldName) {:#log10_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that computes the base-10 logarithm of a numeric value. + Signature: ```typescript -export declare function log(fieldName: string, base: Expression): FunctionExpression; +export declare function log10(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the logarithm of. | -| base | [Expression](./firestore_pipelines.expression.md#expression_class) | The base of the logarithm. A new representing the logarithm of the numeric value. | +| fieldName | string | The name of the field to compute the base-10 logarithm of. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### log10(fieldName) {:#log10_e5b0480} +A new `Expression` representing the base-10 logarithm of the numeric value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that computes the base-10 logarithm of a numeric value. ```typescript // Compute the base-10 logarithm of the 'value' field. @@ -5615,28 +4812,35 @@ log10("value"); ``` +### logicalMaximum(fieldName, second, others) {:#logicalmaximum_828272e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. + Signature: ```typescript -export declare function log10(fieldName: string): FunctionExpression; +export declare function logicalMaximum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to compute the base-10 logarithm of. A new Expr representing the base-10 logarithm of the numeric value. | +| fieldName | string | The first operand field name. | +| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | +| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### logicalMaximum(fieldName, second, others) {:#logicalmaximum_828272e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical maximum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. ```typescript // Returns the largest value between the 'field1' field, the 'field2' field, @@ -5645,10 +4849,17 @@ logicalMaximum("field1", field("field2"), 1000); ``` +### logicalMinimum(fieldName, second, others) {:#logicalminimum_828272e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. + Signature: ```typescript -export declare function logicalMaximum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; +export declare function logicalMinimum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; ``` #### Parameters @@ -5657,18 +4868,16 @@ export declare function logicalMaximum(fieldName: string, second: Expression | u | --- | --- | --- | | fieldName | string | The first operand field name. | | second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical maximum operation. | +| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### logicalMinimum(fieldName, second, others) {:#logicalminimum_828272e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical minimum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the smallest value between a field's value and other input expressions or literal values. Based on Firestore's value type ordering. ```typescript // Returns the smallest value between the 'field1' field, the 'field2' field, @@ -5677,24 +4886,6 @@ logicalMinimum("field1", field("field2"), 1000); ``` -Signature: - -```typescript -export declare function logicalMinimum(fieldName: string, second: Expression | unknown, ...others: Array): FunctionExpression; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| fieldName | string | The first operand field name. | -| second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical minimum operation. | - -Returns: - -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) - ### mapGet(fieldName, subField) {:#mapget_06663cf} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -5702,12 +4893,6 @@ export declare function logicalMinimum(fieldName: string, second: Expression | u Accesses a value from a map (object) field using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -mapGet("address", "city"); - -``` - Signature: ```typescript @@ -5719,12 +4904,23 @@ export declare function mapGet(fieldName: string, subField: string): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name of the map field. | -| subField | string | The key to access in the map. A new representing the value associated with the given key in the map. | +| subField | string | The key to access in the map. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the value associated with the given key in the map. + +### Example + + +```typescript +// Get the 'city' value from the 'address' map field +mapGet("address", "city"); + +``` + ### maximum(fieldName) {:#maximum_e5b0480} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -5732,12 +4928,6 @@ export declare function mapGet(fieldName: string, subField: string): FunctionExp Creates an aggregation that finds the maximum value of a field across multiple stage inputs. -```typescript -// Find the highest score in a leaderboard -maximum("score").as("highestScore"); - -``` - Signature: ```typescript @@ -5748,25 +4938,30 @@ export declare function maximum(fieldName: string): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to find the maximum value of. A new representing the 'maximum' aggregation. | +| fieldName | string | The name of the field to find the maximum value of. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### minimum(fieldName) {:#minimum_e5b0480} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'maximum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that finds the minimum value of a field across multiple stage inputs. ```typescript -// Find the lowest price of all products -minimum("price").as("lowestPrice"); +// Find the highest score in a leaderboard +maximum("score").as("highestScore"); ``` +### minimum(fieldName) {:#minimum_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that finds the minimum value of a field across multiple stage inputs. + Signature: ```typescript @@ -5777,25 +4972,30 @@ export declare function minimum(fieldName: string): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to find the minimum value of. A new representing the 'minimum' aggregation. | +| fieldName | string | The name of the field to find the minimum value of. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### mod(fieldName, expression) {:#mod_1e91657} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'minimum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. ```typescript -// Calculate the remainder of dividing 'field1' by 'field2'. -mod("field1", field("field2")); +// Find the lowest price of all products +minimum("price").as("lowestPrice"); ``` +### mod(fieldName, expression) {:#mod_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. + Signature: ```typescript @@ -5807,25 +5007,30 @@ export declare function mod(fieldName: string, expression: Expression): Function | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The dividend field name. | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The divisor expression. A new representing the modulo operation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The divisor expression. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### mod(fieldName, value) {:#mod_65e2f32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. ```typescript -// Calculate the remainder of dividing 'field1' by 5. -mod("field1", 5); +// Calculate the remainder of dividing 'field1' by 'field2'. +mod("field1", field("field2")); ``` +### mod(fieldName, value) {:#mod_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. + Signature: ```typescript @@ -5837,25 +5042,30 @@ export declare function mod(fieldName: string, value: unknown): FunctionExpressi | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The dividend field name. | -| value | unknown | The divisor constant. A new representing the modulo operation. | +| value | unknown | The divisor constant. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### multiply(fieldName, second) {:#multiply_b75bb8b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that multiplies a field's value by an expression. ```typescript -// Multiply the 'quantity' field by the 'price' field -multiply("quantity", field("price")); +// Calculate the remainder of dividing 'field1' by 5. +mod("field1", 5); ``` +### multiply(fieldName, second) {:#multiply_b75bb8b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that multiplies a field's value by an expression. + Signature: ```typescript @@ -5873,19 +5083,24 @@ export declare function multiply(fieldName: string, second: Expression | unknown [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### notEqual(fieldName, expression) {:#notequal_1e91657} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the multiplication operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to an expression. ```typescript -// Check if the 'status' field is not equal to the value of 'expectedStatus' -notEqual("status", field("expectedStatus")); +// Multiply the 'quantity' field by the 'price' field +multiply("quantity", field("price")); ``` +### notEqual(fieldName, expression) {:#notequal_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to an expression. + Signature: ```typescript @@ -5897,25 +5112,30 @@ export declare function notEqual(fieldName: string, expression: Expression): Boo | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. A new Expr representing the inequality comparison. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### notEqual(fieldName, value) {:#notequal_65e2f32} +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to a constant value. ```typescript -// Check if the 'country' field is not equal to "USA" -notEqual("country", "USA"); +// Check if the 'status' field is not equal to the value of 'expectedStatus' +notEqual("status", field("expectedStatus")); ``` +### notEqual(fieldName, value) {:#notequal_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to a constant value. + Signature: ```typescript @@ -5927,25 +5147,30 @@ export declare function notEqual(fieldName: string, value: unknown): BooleanExpr | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| value | unknown | The constant value to compare to. A new Expr representing the inequality comparison. | +| value | unknown | The constant value to compare to. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### notEqualAny(fieldName, values) {:#notequalany_8060b23} +A new `Expression` representing the inequality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. ```typescript -// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' -notEqualAny("status", [constant("pending"), field("rejectedStatus")]); +// Check if the 'country' field is not equal to "USA" +notEqual("country", "USA"); ``` +### notEqualAny(fieldName, values) {:#notequalany_8060b23} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to any of the provided values or expressions. + Signature: ```typescript @@ -5957,25 +5182,30 @@ export declare function notEqualAny(fieldName: string, values: ArrayReturns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### notEqualAny(fieldName, arrayExpression) {:#notequalany_48da8d9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. ```typescript -// Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' -notEqualAny("status", field("rejectedStatuses")); +// Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' +notEqualAny("status", [constant("pending"), field("rejectedStatus")]); ``` +### notEqualAny(fieldName, arrayExpression) {:#notequalany_48da8d9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. + Signature: ```typescript @@ -5987,25 +5217,30 @@ export declare function notEqualAny(fieldName: string, arrayExpression: Expressi | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to compare. | -| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The values to check against. A new representing the 'NOT IN' comparison. | +| arrayExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The values to check against. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(fieldName, pattern) {:#regexcontains_67f7432} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'NOT IN' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a specified regular expression as a substring. ```typescript -// Check if the 'description' field contains "example" (case-insensitive) -regexContains("description", "(?i)example"); +// Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' +notEqualAny("status", field("rejectedStatuses")); ``` +### regexContains(fieldName, pattern) {:#regexcontains_67f7432} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a specified regular expression as a substring. + Signature: ```typescript @@ -6017,25 +5252,30 @@ export declare function regexContains(fieldName: string, pattern: string): Boole | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | string | The regular expression to use for the search. A new representing the 'contains' comparison. | +| pattern | string | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(fieldName, pattern) {:#regexcontains_cb1318d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) -regexContains("description", field("pattern")); +regexContains("description", "(?i)example"); ``` +### regexContains(fieldName, pattern) {:#regexcontains_cb1318d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a specified regular expression as a substring. + Signature: ```typescript @@ -6047,25 +5287,30 @@ export declare function regexContains(fieldName: string, pattern: Expression): B | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the search. A new representing the 'contains' comparison. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(fieldName, pattern) {:#regexmatch_67f7432} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field matches a specified regular expression. ```typescript -// Check if the 'email' field matches a valid email pattern -regexMatch("email", "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); +// Check if the 'description' field contains "example" (case-insensitive) +regexContains("description", field("pattern")); ``` +### regexMatch(fieldName, pattern) {:#regexmatch_67f7432} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field matches a specified regular expression. + Signature: ```typescript @@ -6077,25 +5322,30 @@ export declare function regexMatch(fieldName: string, pattern: string): BooleanE | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | string | The regular expression to use for the match. A new representing the regular expression match. | +| pattern | string | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(fieldName, pattern) {:#regexmatch_cb1318d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern -regexMatch("email", field("pattern")); +regexMatch("email", "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); ``` +### regexMatch(fieldName, pattern) {:#regexmatch_cb1318d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field matches a specified regular expression. + Signature: ```typescript @@ -6107,25 +5357,30 @@ export declare function regexMatch(fieldName: string, pattern: Expression): Bool | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the match. A new representing the regular expression match. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### round(fieldName) {:#round_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the nearest whole number. ```typescript -// Round the value of the 'price' field. -round("price"); +// Check if the 'email' field matches a valid email pattern +regexMatch("email", field("pattern")); ``` +### round(fieldName) {:#round_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the nearest whole number. + Signature: ```typescript @@ -6136,25 +5391,30 @@ export declare function round(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field to round. A new Expr representing the rounded value. | +| fieldName | string | The name of the field to round. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### round(fieldName, decimalPlaces) {:#round_07d0cf0} +A new `Expression` representing the rounded value. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that rounds a numeric value to the specified number of decimal places. ```typescript -// Round the value of the 'price' field to two decimal places. -round("price", 2); +// Round the value of the 'price' field. +round("price"); ``` +### round(fieldName, decimalPlaces) {:#round_07d0cf0} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that rounds a numeric value to the specified number of decimal places. + Signature: ```typescript @@ -6166,12 +5426,23 @@ export declare function round(fieldName: string, decimalPlaces: number | Express | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field to round. | -| decimalPlaces | number \| [Expression](./firestore_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. A new Expr representing the rounded value. | +| decimalPlaces | number \| [Expression](./firestore_pipelines.expression.md#expression_class) | A constant or expression specifying the rounding precision in decimal places. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the rounded value. + +### Example + + +```typescript +// Round the value of the 'price' field to two decimal places. +round("price", 2); + +``` + ### split(fieldName, delimiter) {:#split_2cfdd37} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -6190,12 +5461,14 @@ export declare function split(fieldName: string, delimiter: string): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | Split the value in this field. | -| delimiter | string | Split on this delimiter. A new representing the split function. | +| delimiter | string | Split on this delimiter. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -6223,12 +5496,14 @@ export declare function split(fieldName: string, delimiter: Expression): Functio | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | Split the value in this field. | -| delimiter | [Expression](./firestore_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. A new representing the split function. | +| delimiter | [Expression](./firestore_pipelines.expression.md#expression_class) | Split on this delimiter returned by evaluating this expression. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the split function. + ### Example @@ -6245,12 +5520,6 @@ split('scores', conditional(field('format').equal('csv'), constant(','), constan Creates an expression that computes the square root of a numeric value. -```typescript -// Compute the square root of the 'value' field. -sqrt("value"); - -``` - Signature: ```typescript @@ -6259,13 +5528,24 @@ export declare function sqrt(fieldName: string): FunctionExpression; #### Parameters -| Parameter | Type | Description | -| --- | --- | --- | -| fieldName | string | The name of the field to compute the square root of. A new representing the square root of the numeric value. | +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | The name of the field to compute the square root of. | + +Returns: + +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the square root of the numeric value. + +### Example + -Returns: +```typescript +// Compute the square root of the 'value' field. +sqrt("value"); -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +``` ### startsWith(fieldName, prefix) {:#startswith_89325cc} @@ -6274,12 +5554,6 @@ export declare function sqrt(fieldName: string): FunctionExpression; Creates an expression that checks if a field's value starts with a given prefix. -```typescript -// Check if the 'name' field starts with "Mr." -startsWith("name", "Mr."); - -``` - Signature: ```typescript @@ -6291,25 +5565,30 @@ export declare function startsWith(fieldName: string, prefix: string): BooleanEx | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| prefix | string | The prefix to check for. A new representing the 'starts with' comparison. | +| prefix | string | The prefix to check for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### startsWith(fieldName, prefix) {:#startswith_266c338} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a field's value starts with a given prefix. ```typescript -// Check if the 'fullName' field starts with the value of the 'firstName' field -startsWith("fullName", field("firstName")); +// Check if the 'name' field starts with "Mr." +startsWith("name", "Mr."); ``` +### startsWith(fieldName, prefix) {:#startswith_266c338} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a field's value starts with a given prefix. + Signature: ```typescript @@ -6321,25 +5600,30 @@ export declare function startsWith(fieldName: string, prefix: Expression): Boole | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to check. | -| prefix | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the prefix. A new representing the 'starts with' comparison. | +| prefix | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the prefix. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### stringConcat(fieldName, secondString, otherStrings) {:#stringconcat_d80077e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates string functions, fields or constants together. ```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat("firstName", " ", field("lastName")); +// Check if the 'fullName' field starts with the value of the 'firstName' field +startsWith("fullName", field("firstName")); ``` +### stringConcat(fieldName, secondString, otherStrings) {:#stringconcat_d80077e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates string functions, fields or constants together. + Signature: ```typescript @@ -6352,25 +5636,30 @@ export declare function stringConcat(fieldName: string, secondString: Expression | --- | --- | --- | | fieldName | string | The field name containing the initial string value. | | secondString | [Expression](./firestore_pipelines.expression.md#expression_class) \| string | An expression or string literal to concatenate. | -| otherStrings | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. A new representing the concatenated string. | +| otherStrings | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### stringContains(fieldName, substring) {:#stringcontains_5b94cfe} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a specified substring. ```typescript -// Check if the 'description' field contains "example". -stringContains("description", "example"); +// Combine the 'firstName', " ", and 'lastName' fields into a single string +stringConcat("firstName", " ", field("lastName")); ``` +### stringContains(fieldName, substring) {:#stringcontains_5b94cfe} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a specified substring. + Signature: ```typescript @@ -6382,25 +5671,30 @@ export declare function stringContains(fieldName: string, substring: string): Bo | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| substring | string | The substring to search for. A new representing the 'contains' comparison. | +| substring | string | The substring to search for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### stringContains(fieldName, substring) {:#stringcontains_ac3ba47} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string field contains a substring specified by an expression. ```typescript -// Check if the 'description' field contains the value of the 'keyword' field. -stringContains("description", field("keyword")); +// Check if the 'description' field contains "example". +stringContains("description", "example"); ``` +### stringContains(fieldName, substring) {:#stringcontains_ac3ba47} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string field contains a substring specified by an expression. + Signature: ```typescript @@ -6412,25 +5706,30 @@ export declare function stringContains(fieldName: string, substring: Expression) | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The name of the field containing the string. | -| substring | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the substring to search for. A new representing the 'contains' comparison. | +| substring | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the substring to search for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### subtract(fieldName, expression) {:#subtract_1e91657} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts an expression from a field's value. ```typescript -// Subtract the 'discount' field from the 'price' field -subtract("price", field("discount")); +// Check if the 'description' field contains the value of the 'keyword' field. +stringContains("description", field("keyword")); ``` +### subtract(fieldName, expression) {:#subtract_1e91657} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts an expression from a field's value. + Signature: ```typescript @@ -6442,25 +5741,30 @@ export declare function subtract(fieldName: string, expression: Expression): Fun | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to subtract from. | -| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract. A new representing the subtraction operation. | +| expression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### subtract(fieldName, value) {:#subtract_65e2f32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a constant value from a field's value. ```typescript -// Subtract 20 from the value of the 'total' field -subtract("total", 20); +// Subtract the 'discount' field from the 'price' field +subtract("price", field("discount")); ``` +### subtract(fieldName, value) {:#subtract_65e2f32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a constant value from a field's value. + Signature: ```typescript @@ -6472,25 +5776,30 @@ export declare function subtract(fieldName: string, value: unknown): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | fieldName | string | The field name to subtract from. | -| value | unknown | The constant value to subtract. A new representing the subtraction operation. | +| value | unknown | The constant value to subtract. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### sum(fieldName) {:#sum_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. ```typescript -// Calculate the total revenue from a set of orders -sum("orderAmount").as("totalRevenue"); +// Subtract 20 from the value of the 'total' field +subtract("total", 20); ``` +### sum(fieldName) {:#sum_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an aggregation that calculates the sum of a field's values across multiple stage inputs. + Signature: ```typescript @@ -6501,25 +5810,30 @@ export declare function sum(fieldName: string): AggregateFunction; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing numeric values to sum up. A new representing the 'sum' aggregation. | +| fieldName | string | The name of the field containing numeric values to sum up. | Returns: [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) -### timestampAdd(fieldName, unit, amount) {:#timestampadd_341fe7d} +A new [AggregateFunction](./firestore_pipelines.aggregatefunction.md#aggregatefunction_class) representing the 'sum' aggregation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to a timestamp represented by a field. ```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd("timestamp", "day", 1); +// Calculate the total revenue from a set of orders +sum("orderAmount").as("totalRevenue"); ``` +### timestampAdd(fieldName, unit, amount) {:#timestampadd_341fe7d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to a timestamp represented by a field. + Signature: ```typescript @@ -6532,25 +5846,30 @@ export declare function timestampAdd(fieldName: string, unit: 'microsecond' | 'm | --- | --- | --- | | fieldName | string | The name of the field representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to add (e.g., "day", "hour"). | -| amount | number | The amount of time to add. A new representing the resulting timestamp. | +| amount | number | The amount of time to add. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampSubtract(fieldName, unit, amount) {:#timestampsubtract_341fe7d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. ```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract("timestamp", "day", 1); +// Add 1 day to the 'timestamp' field. +timestampAdd("timestamp", "day", 1); ``` +### timestampSubtract(fieldName, unit, amount) {:#timestampsubtract_341fe7d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. + Signature: ```typescript @@ -6563,25 +5882,30 @@ export declare function timestampSubtract(fieldName: string, unit: 'microsecond' | --- | --- | --- | | fieldName | string | The name of the field representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to subtract (e.g., "day", "hour"). | -| amount | number | The amount of time to subtract. A new representing the resulting timestamp. | +| amount | number | The amount of time to subtract. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixMicros(fieldName) {:#timestamptounixmicros_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to microseconds since epoch. -timestampToUnixMicros("timestamp"); +// Subtract 1 day from the 'timestamp' field. +timestampSubtract("timestamp", "day", 1); ``` +### timestampToUnixMicros(fieldName) {:#timestamptounixmicros_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -6592,25 +5916,30 @@ export declare function timestampToUnixMicros(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the timestamp. A new representing the number of microseconds since epoch. | +| fieldName | string | The name of the field representing the timestamp. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixMillis(fieldName) {:#timestamptounixmillis_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of microseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to milliseconds since epoch. -timestampToUnixMillis("timestamp"); +// Convert the 'timestamp' field to microseconds since epoch. +timestampToUnixMicros("timestamp"); ``` +### timestampToUnixMillis(fieldName) {:#timestamptounixmillis_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -6621,25 +5950,30 @@ export declare function timestampToUnixMillis(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the timestamp. A new representing the number of milliseconds since epoch. | +| fieldName | string | The name of the field representing the timestamp. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampToUnixSeconds(fieldName) {:#timestamptounixseconds_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of milliseconds since epoch. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). ```typescript -// Convert the 'timestamp' field to seconds since epoch. -timestampToUnixSeconds("timestamp"); +// Convert the 'timestamp' field to milliseconds since epoch. +timestampToUnixMillis("timestamp"); ``` +### timestampToUnixSeconds(fieldName) {:#timestamptounixseconds_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). + Signature: ```typescript @@ -6650,12 +5984,23 @@ export declare function timestampToUnixSeconds(fieldName: string): FunctionExpre | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the timestamp. A new representing the number of seconds since epoch. | +| fieldName | string | The name of the field representing the timestamp. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the number of seconds since epoch. + +### Example + + +```typescript +// Convert the 'timestamp' field to seconds since epoch. +timestampToUnixSeconds("timestamp"); + +``` + ### timestampTruncate(fieldName, granularity, timezone) {:#timestamptruncate_b6c7512} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -6675,12 +6020,14 @@ export declare function timestampTruncate(fieldName: string, granularity: TimeGr | --- | --- | --- | | fieldName | string | Truncate the timestamp value contained in this field. | | granularity | [TimeGranularity](./firestore_pipelines.md#timegranularity) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -6709,12 +6056,14 @@ export declare function timestampTruncate(fieldName: string, granularity: Expres | --- | --- | --- | | fieldName | string | Truncate the timestamp value contained in this field. | | granularity | [Expression](./firestore_pipelines.expression.md#expression_class) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -6731,34 +6080,60 @@ field('createdAt').timestampTruncate(field('granularity')) Creates an expression that converts a string field to lowercase. +Signature: + +```typescript +export declare function toLower(fieldName: string): FunctionExpression; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| fieldName | string | The name of the field containing the string. | + +Returns: + +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the lowercase string. + +### Example + + ```typescript // Convert the 'name' field to lowercase toLower("name"); ``` +### toUpper(fieldName) {:#toupper_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string field to uppercase. + Signature: ```typescript -export declare function toLower(fieldName: string): FunctionExpression; +export declare function toUpper(fieldName: string): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the lowercase string. | +| fieldName | string | The name of the field containing the string. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### toUpper(fieldName) {:#toupper_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the uppercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string field to uppercase. ```typescript // Convert the 'title' field to uppercase @@ -6766,28 +6141,34 @@ toUpper("title"); ``` +### trim(fieldName, valueToTrim) {:#trim_c9f90ee} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes leading and trailing whitespace from a string or byte array. + Signature: ```typescript -export declare function toUpper(fieldName: string): FunctionExpression; +export declare function trim(fieldName: string, valueToTrim?: string | Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field containing the string. A new representing the uppercase string. | +| fieldName | string | The name of the field containing the string or byte array. | +| valueToTrim | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### trim(fieldName, valueToTrim) {:#trim_c9f90ee} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the trimmed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes leading and trailing whitespace from a string or byte array. ```typescript // Trim whitespace from the 'userInput' field @@ -6798,23 +6179,6 @@ trim("userInput", '"'); ``` -Signature: - -```typescript -export declare function trim(fieldName: string, valueToTrim?: string | Expression): FunctionExpression; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| fieldName | string | The name of the field containing the string or byte array. | -| valueToTrim | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. A new representing the trimmed string. | - -Returns: - -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) - ### type(fieldName) {:#type_e5b0480} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -6838,6 +6202,8 @@ export declare function type(fieldName: string): FunctionExpression; [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the data type. + ### Example @@ -6846,7 +6212,6 @@ export declare function type(fieldName: string): FunctionExpression; type('title') ``` - A new {Expression} representing the data type. ### unixMicrosToTimestamp(fieldName) {:#unixmicrostotimestamp_e5b0480} @@ -6855,12 +6220,6 @@ type('title') Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. -```typescript -// Interpret the 'microseconds' field as microseconds since epoch. -unixMicrosToTimestamp("microseconds"); - -``` - Signature: ```typescript @@ -6871,25 +6230,30 @@ export declare function unixMicrosToTimestamp(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the number of microseconds since epoch. A new representing the timestamp. | +| fieldName | string | The name of the field representing the number of microseconds since epoch. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### unixMillisToTimestamp(fieldName) {:#unixmillistotimestamp_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'milliseconds' field as milliseconds since epoch. -unixMillisToTimestamp("milliseconds"); +// Interpret the 'microseconds' field as microseconds since epoch. +unixMicrosToTimestamp("microseconds"); ``` +### unixMillisToTimestamp(fieldName) {:#unixmillistotimestamp_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript @@ -6900,25 +6264,30 @@ export declare function unixMillisToTimestamp(fieldName: string): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the number of milliseconds since epoch. A new representing the timestamp. | +| fieldName | string | The name of the field representing the number of milliseconds since epoch. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### unixSecondsToTimestamp(fieldName) {:#unixsecondstotimestamp_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. ```typescript -// Interpret the 'seconds' field as seconds since epoch. -unixSecondsToTimestamp("seconds"); +// Interpret the 'milliseconds' field as milliseconds since epoch. +unixMillisToTimestamp("milliseconds"); ``` +### unixSecondsToTimestamp(fieldName) {:#unixsecondstotimestamp_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) and returns a timestamp. + Signature: ```typescript @@ -6929,25 +6298,30 @@ export declare function unixSecondsToTimestamp(fieldName: string): FunctionExpre | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the number of seconds since epoch. A new representing the timestamp. | +| fieldName | string | The name of the field representing the number of seconds since epoch. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### vectorLength(fieldName) {:#vectorlength_e5b0480} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a Firestore Vector represented by a field. ```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength("embedding"); +// Interpret the 'seconds' field as seconds since epoch. +unixSecondsToTimestamp("seconds"); ``` +### vectorLength(fieldName) {:#vectorlength_e5b0480} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a Firestore Vector represented by a field. + Signature: ```typescript @@ -6958,12 +6332,23 @@ export declare function vectorLength(fieldName: string): FunctionExpression; | Parameter | Type | Description | | --- | --- | --- | -| fieldName | string | The name of the field representing the Firestore Vector. A new representing the length of the array. | +| fieldName | string | The name of the field representing the Firestore Vector. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. + +### Example + + +```typescript +// Get the vector length (dimension) of the field 'embedding'. +vectorLength("embedding"); + +``` + ## function(first, ...) ### add(first, second) {:#add_846ca1b} @@ -6973,12 +6358,6 @@ export declare function vectorLength(fieldName: string): FunctionExpression; Creates an expression that adds two expressions together. -```typescript -// Add the value of the 'quantity' field and the 'reserve' field. -add(field("quantity"), field("reserve")); - -``` - Signature: ```typescript @@ -6996,20 +6375,24 @@ export declare function add(first: Expression, second: Expression | unknown): Fu [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### and(first, second, more) {:#and_e0c48bd} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the addition operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a logical 'AND' operation on multiple filter conditions. ```typescript -// Check if the 'age' field is greater than 18 AND the 'city' field is "London" AND -// the 'status' field is "active" -const condition = and(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); +// Add the value of the 'quantity' field and the 'reserve' field. +add(field("quantity"), field("reserve")); ``` +### and(first, second, more) {:#and_e0c48bd} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a logical 'AND' operation on multiple filter conditions. + Signature: ```typescript @@ -7022,25 +6405,31 @@ export declare function and(first: BooleanExpression, second: BooleanExpression, | --- | --- | --- | | first | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The first filter condition. | | second | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The second filter condition. | -| more | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'AND' together. A new representing the logical 'AND' operation. | +| more | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'AND' together. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### concat(first, second, others) {:#concat_83be015} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical 'AND' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. ```typescript -// Concatenate the 'firstName' and 'lastName' fields with a space in between. -concat(field("firstName"), " ", field("lastName")) +// Check if the 'age' field is greater than 18 AND the 'city' field is "London" AND +// the 'status' field is "active" +const condition = and(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); ``` +### concat(first, second, others) {:#concat_83be015} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. + Signature: ```typescript @@ -7053,26 +6442,30 @@ export declare function concat(first: Expression, second: Expression | unknown, | --- | --- | --- | | first | [Expression](./firestore_pipelines.expression.md#expression_class) | The first expressions to concatenate. | | second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second literal or expression to concatenate. | -| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Additional literals or expressions to concatenate. A new Expression representing the concatenation. | +| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Additional literals or expressions to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### logicalMaximum(first, second, others) {:#logicalmaximum_83be015} +A new `Expression` representing the concatenation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. ```typescript -// Returns the largest value between the 'field1' field, the 'field2' field, -// and 1000 -logicalMaximum(field("field1"), field("field2"), 1000); +// Concatenate the 'firstName' and 'lastName' fields with a space in between. +concat(field("firstName"), " ", field("lastName")) ``` +### logicalMaximum(first, second, others) {:#logicalmaximum_83be015} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the largest value between multiple input expressions or literal values. Based on Firestore's value type ordering. + Signature: ```typescript @@ -7085,26 +6478,31 @@ export declare function logicalMaximum(first: Expression, second: Expression | u | --- | --- | --- | | first | [Expression](./firestore_pipelines.expression.md#expression_class) | The first operand expression. | | second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical maximum operation. | +| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### logicalMinimum(first, second, others) {:#logicalminimum_83be015} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical maximum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. ```typescript -// Returns the smallest value between the 'field1' field, the 'field2' field, -// and 1000. -logicalMinimum(field("field1"), field("field2"), 1000); +// Returns the largest value between the 'field1' field, the 'field2' field, +// and 1000 +logicalMaximum(field("field1"), field("field2"), 1000); ``` +### logicalMinimum(first, second, others) {:#logicalminimum_83be015} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the smallest value between multiple input expressions and literal values. Based on Firestore's value type ordering. + Signature: ```typescript @@ -7117,25 +6515,31 @@ export declare function logicalMinimum(first: Expression, second: Expression | u | --- | --- | --- | | first | [Expression](./firestore_pipelines.expression.md#expression_class) | The first operand expression. | | second | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The second expression or literal. | -| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. A new representing the logical minimum operation. | +| others | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown> | Optional additional expressions or literals. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### multiply(first, second) {:#multiply_846ca1b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical minimum operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that multiplies two expressions together. ```typescript -// Multiply the 'quantity' field by the 'price' field -multiply(field("quantity"), field("price")); +// Returns the smallest value between the 'field1' field, the 'field2' field, +// and 1000. +logicalMinimum(field("field1"), field("field2"), 1000); ``` +### multiply(first, second) {:#multiply_846ca1b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that multiplies two expressions together. + Signature: ```typescript @@ -7153,20 +6557,24 @@ export declare function multiply(first: Expression, second: Expression | unknown [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### or(first, second, more) {:#or_e0c48bd} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the multiplication operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a logical 'OR' operation on multiple filter conditions. ```typescript -// Check if the 'age' field is greater than 18 OR the 'city' field is "London" OR -// the 'status' field is "active" -const condition = or(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); +// Multiply the 'quantity' field by the 'price' field +multiply(field("quantity"), field("price")); ``` +### or(first, second, more) {:#or_e0c48bd} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a logical 'OR' operation on multiple filter conditions. + Signature: ```typescript @@ -7179,29 +6587,31 @@ export declare function or(first: BooleanExpression, second: BooleanExpression, | --- | --- | --- | | first | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The first filter condition. | | second | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The second filter condition. | -| more | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'OR' together. A new representing the logical 'OR' operation. | +| more | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional filter conditions to 'OR' together. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### xor(first, second, additionalConditions) {:#xor_8197113} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical 'OR' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. ```typescript -// Check if only one of the conditions is true: 'age' greater than 18, 'city' is "London", -// or 'status' is "active". -const condition = xor( - greaterThan("age", 18), - equal("city", "London"), - equal("status", "active")); +// Check if the 'age' field is greater than 18 OR the 'city' field is "London" OR +// the 'status' field is "active" +const condition = or(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); ``` +### xor(first, second, additionalConditions) {:#xor_8197113} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. + Signature: ```typescript @@ -7214,12 +6624,27 @@ export declare function xor(first: BooleanExpression, second: BooleanExpression, | --- | --- | --- | | first | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The first condition. | | second | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The second condition. | -| additionalConditions | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional conditions to 'XOR' together. A new representing the logical 'XOR' operation. | +| additionalConditions | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class)\[\] | Additional conditions to 'XOR' together. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the logical 'XOR' operation. + +### Example + + +```typescript +// Check if only one of the conditions is true: 'age' greater than 18, 'city' is "London", +// or 'status' is "active". +const condition = xor( + greaterThan("age", 18), + equal("city", "London"), + equal("status", "active")); + +``` + ## function(firstArray, ...) ### arrayConcat(firstArray, secondArray, otherArrays) {:#arrayconcat_c00d5d7} @@ -7229,12 +6654,6 @@ export declare function xor(first: BooleanExpression, second: BooleanExpression, Creates an expression that concatenates an array expression with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat(field("items"), [field("newItems"), field("otherItems")]); - -``` - Signature: ```typescript @@ -7247,11 +6666,22 @@ export declare function arrayConcat(firstArray: Expression, secondArray: Express | --- | --- | --- | | firstArray | [Expression](./firestore_pipelines.expression.md#expression_class) | The first array expression to concatenate to. | | secondArray | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\] | The second array expression or array literal to concatenate to. | -| otherArrays | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. A new representing the concatenated array. | +| otherArrays | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated array. + +### Example + + +```typescript +// Combine the 'items' array with two new item arrays +arrayConcat(field("items"), [field("newItems"), field("otherItems")]); + +``` ## function(firstArrayField, ...) @@ -7262,12 +6692,6 @@ export declare function arrayConcat(firstArray: Expression, secondArray: Express Creates an expression that concatenates a field's array value with other arrays. -```typescript -// Combine the 'items' array with two new item arrays -arrayConcat("items", [field("newItems"), field("otherItems")]); - -``` - Signature: ```typescript @@ -7280,12 +6704,23 @@ export declare function arrayConcat(firstArrayField: string, secondArray: Expres | --- | --- | --- | | firstArrayField | string | The first array to concatenate to. | | secondArray | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\] | The second array expression or array literal to concatenate to. | -| otherArrays | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. A new representing the concatenated array. | +| otherArrays | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| unknown\[\]> | Optional additional array expressions or array literals to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated array. + +### Example + + +```typescript +// Combine the 'items' array with two new item arrays +arrayConcat("items", [field("newItems"), field("otherItems")]); + +``` + ## function(firstMap, ...) ### mapMerge(firstMap, secondMap, otherMaps) {:#mapmerge_cfe77ce} @@ -7295,13 +6730,6 @@ export declare function arrayConcat(firstArrayField: string, secondArray: Expres Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - Signature: ```typescript @@ -7320,6 +6748,16 @@ export declare function mapMerge(firstMap: Record | Expression, [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +### Example + + +``` +// Merges the map in the settings field with, a map literal, and a map in +// that is conditionally returned by another expression +mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) + +``` + ## function(firstString, ...) ### stringConcat(firstString, secondString, otherStrings) {:#stringconcat_8a8d1b6} @@ -7329,12 +6767,6 @@ export declare function mapMerge(firstMap: Record | Expression, Creates an expression that concatenates string expressions together. -```typescript -// Combine the 'firstName', " ", and 'lastName' fields into a single string -stringConcat(field("firstName"), " ", field("lastName")); - -``` - Signature: ```typescript @@ -7347,12 +6779,23 @@ export declare function stringConcat(firstString: Expression, secondString: Expr | --- | --- | --- | | firstString | [Expression](./firestore_pipelines.expression.md#expression_class) | The initial string expression to concatenate to. | | secondString | [Expression](./firestore_pipelines.expression.md#expression_class) \| string | An expression or string literal to concatenate. | -| otherStrings | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. A new representing the concatenated string. | +| otherStrings | Array<[Expression](./firestore_pipelines.expression.md#expression_class) \| string> | Optional additional expressions or literals (typically strings) to concatenate. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the concatenated string. + +### Example + + +```typescript +// Combine the 'firstName', " ", and 'lastName' fields into a single string +stringConcat(field("firstName"), " ", field("lastName")); + +``` + ## function(ifExpr, ...) ### ifAbsent(ifExpr, elseExpr) {:#ifabsent_0e6d161} @@ -7362,13 +6805,6 @@ export declare function stringConcat(firstString: Expression, secondString: Expr Creates an expression that returns the `elseExpr` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. -```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent(field("optional_field"), constant("default_value")) - -``` - Signature: ```typescript @@ -7380,26 +6816,31 @@ export declare function ifAbsent(ifExpr: Expression, elseExpr: Expression): Expr | Parameter | Type | Description | | --- | --- | --- | | ifExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check for absence. | -| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if \[ifExpr\] is absent. A new Expression representing the ifAbsent operation. | +| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if \[ifExpr\] is absent. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) -### ifAbsent(ifExpr, elseValue) {:#ifabsent_c34e5ed} +A new Expression representing the ifAbsent operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. ```typescript // Returns the value of the optional field 'optional_field', or returns 'default_value' // if the field is absent. -ifAbsent(field("optional_field"), "default_value") +ifAbsent(field("optional_field"), constant("default_value")) ``` +### ifAbsent(ifExpr, elseValue) {:#ifabsent_c34e5ed} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else return the result of the `ifExpr` argument evaluation. + Signature: ```typescript @@ -7411,12 +6852,24 @@ export declare function ifAbsent(ifExpr: Expression, elseValue: unknown): Expres | Parameter | Type | Description | | --- | --- | --- | | ifExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check for absence. | -| elseValue | unknown | The value that will be returned if ifExpr evaluates to an absent value. A new \[Expression\] representing the ifAbsent operation. | +| elseValue | unknown | The value that will be returned if ifExpr evaluates to an absent value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new \[Expression\] representing the ifAbsent operation. + +### Example + + +```typescript +// Returns the value of the optional field 'optional_field', or returns 'default_value' +// if the field is absent. +ifAbsent(field("optional_field"), "default_value") + +``` + ## function(ifFieldName, ...) ### ifAbsent(ifFieldName, elseExpr) {:#ifabsent_e6dabea} @@ -7426,13 +6879,6 @@ export declare function ifAbsent(ifExpr: Expression, elseValue: unknown): Expres Creates an expression that returns the `elseExpr` argument if `ifFieldName` is absent, else return the value of the field. -```typescript -// Returns the value of the optional field 'optional_field', or returns the value of -// 'default_field' if 'optional_field' is absent. -ifAbsent("optional_field", field("default_field")) - -``` - Signature: ```typescript @@ -7444,26 +6890,31 @@ export declare function ifAbsent(ifFieldName: string, elseExpr: Expression): Exp | Parameter | Type | Description | | --- | --- | --- | | ifFieldName | string | The field to check for absence. | -| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if ifFieldName is absent. A new Expression representing the ifAbsent operation. | +| elseExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression that will be evaluated and returned if ifFieldName is absent. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) -### ifAbsent(ifFieldName, elseValue) {:#ifabsent_d8f2823} +A new Expression representing the ifAbsent operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else return the value of the field. ```typescript -// Returns the value of the optional field 'optional_field', or returns 'default_value' -// if the field is absent. -ifAbsent("optional_field", "default_value") +// Returns the value of the optional field 'optional_field', or returns the value of +// 'default_field' if 'optional_field' is absent. +ifAbsent("optional_field", field("default_field")) ``` +### ifAbsent(ifFieldName, elseValue) {:#ifabsent_d8f2823} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else return the value of the field. + Signature: ```typescript @@ -7475,12 +6926,24 @@ export declare function ifAbsent(ifFieldName: string | Expression, elseValue: Ex | Parameter | Type | Description | | --- | --- | --- | | ifFieldName | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The field to check for absence. | -| elseValue | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The value that will be returned if \[ifFieldName\] is absent. A new Expression representing the ifAbsent operation. | +| elseValue | [Expression](./firestore_pipelines.expression.md#expression_class) \| unknown | The value that will be returned if \[ifFieldName\] is absent. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new Expression representing the ifAbsent operation. + +### Example + + +```typescript +// Returns the value of the optional field 'optional_field', or returns 'default_value' +// if the field is absent. +ifAbsent("optional_field", "default_value") + +``` + ## function(input, ...) ### substring(input, position, length) {:#substring_e6e0aa3} @@ -7542,12 +7005,6 @@ export declare function substring(input: Expression, position: Expression, lengt Creates an expression that divides two expressions. -```typescript -// Divide the 'total' field by the 'count' field -divide(field("total"), field("count")); - -``` - Signature: ```typescript @@ -7559,25 +7016,30 @@ export declare function divide(left: Expression, right: Expression): FunctionExp | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to be divided. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. A new representing the division operation. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to divide by. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### equal(left, right) {:#equal_b3c3382} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the division operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if two expressions are equal. ```typescript -// Check if the 'age' field is equal to an expression -equal(field("age"), field("minAge").add(10)); +// Divide the 'total' field by the 'count' field +divide(field("total"), field("count")); ``` +### equal(left, right) {:#equal_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if two expressions are equal. + Signature: ```typescript @@ -7589,25 +7051,30 @@ export declare function equal(left: Expression, right: Expression): BooleanExpre | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the equality comparison. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThan(left, right) {:#greaterthan_b3c3382} +A new `Expression` representing the equality comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is greater than the second expression. ```typescript -// Check if the 'age' field is greater than 18 -greaterThan(field("age"), Constant(9).add(9)); +// Check if the 'age' field is equal to an expression +equal(field("age"), field("minAge").add(10)); ``` +### greaterThan(left, right) {:#greaterthan_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is greater than the second expression. + Signature: ```typescript @@ -7619,25 +7086,30 @@ export declare function greaterThan(left: Expression, right: Expression): Boolea | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the greater than comparison. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### greaterThanOrEqual(left, right) {:#greaterthanorequal_b3c3382} +A new `Expression` representing the greater than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is greater than or equal to the second expression. ```typescript -// Check if the 'quantity' field is greater than or equal to the field "threshold" -greaterThanOrEqual(field("quantity"), field("threshold")); +// Check if the 'age' field is greater than 18 +greaterThan(field("age"), Constant(9).add(9)); ``` +### greaterThanOrEqual(left, right) {:#greaterthanorequal_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is greater than or equal to the second expression. + Signature: ```typescript @@ -7649,25 +7121,30 @@ export declare function greaterThanOrEqual(left: Expression, right: Expression): | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the greater than or equal to comparison. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### lessThan(left, right) {:#lessthan_b3c3382} +A new `Expression` representing the greater than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is less than the second expression. ```typescript -// Check if the 'age' field is less than 30 -lessThan(field("age"), field("limit")); +// Check if the 'quantity' field is greater than or equal to the field "threshold" +greaterThanOrEqual(field("quantity"), field("threshold")); ``` +### lessThan(left, right) {:#lessthan_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is less than the second expression. + Signature: ```typescript @@ -7679,25 +7156,30 @@ export declare function lessThan(left: Expression, right: Expression): BooleanEx | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the less than comparison. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### lessThanOrEqual(left, right) {:#lessthanorequal_b3c3382} +A new `Expression` representing the less than comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if the first expression is less than or equal to the second expression. ```typescript -// Check if the 'quantity' field is less than or equal to 20 -lessThan(field("quantity"), field("limit")); +// Check if the 'age' field is less than 30 +lessThan(field("age"), field("limit")); ``` +### lessThanOrEqual(left, right) {:#lessthanorequal_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if the first expression is less than or equal to the second expression. + Signature: ```typescript @@ -7709,25 +7191,30 @@ export declare function lessThanOrEqual(left: Expression, right: Expression): Bo | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the less than or equal to comparison. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### mod(left, right) {:#mod_b3c3382} +A new `Expression` representing the less than or equal to comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the modulo (remainder) of dividing two expressions. ```typescript -// Calculate the remainder of dividing 'field1' by 'field2'. -mod(field("field1"), field("field2")); +// Check if the 'quantity' field is less than or equal to 20 +lessThan(field("quantity"), field("limit")); ``` +### mod(left, right) {:#mod_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the modulo (remainder) of dividing two expressions. + Signature: ```typescript @@ -7739,25 +7226,30 @@ export declare function mod(left: Expression, right: Expression): FunctionExpres | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The dividend expression. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The divisor expression. A new representing the modulo operation. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The divisor expression. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### notEqual(left, right) {:#notequal_b3c3382} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the modulo operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if two expressions are not equal. ```typescript -// Check if the 'status' field is not equal to field 'finalState' -notEqual(field("status"), field("finalState")); +// Calculate the remainder of dividing 'field1' by 'field2'. +mod(field("field1"), field("field2")); ``` +### notEqual(left, right) {:#notequal_b3c3382} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if two expressions are not equal. + Signature: ```typescript @@ -7769,12 +7261,23 @@ export declare function notEqual(left: Expression, right: Expression): BooleanEx | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The first expression to compare. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. A new Expr representing the inequality comparison. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The second expression to compare. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A new `Expression` representing the inequality comparison. + +### Example + + +```typescript +// Check if the 'status' field is not equal to field 'finalState' +notEqual(field("status"), field("finalState")); + +``` + ### pipelineResultEqual(left, right) {:#pipelineresultequal_707a755} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -7792,8 +7295,8 @@ export declare function pipelineResultEqual(left: PipelineResult, right: Pipelin | Parameter | Type | Description | | --- | --- | --- | -| left | [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) | | -| right | [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) | | +| left | [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) | First PipelineResult to compare. | +| right | [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) | Second PipelineResult to compare. | Returns: @@ -7801,16 +7304,10 @@ boolean ### subtract(left, right) {:#subtract_b3c3382} -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> - -Creates an expression that subtracts two expressions. - -```typescript -// Subtract the 'discount' field from the 'price' field -subtract(field("price"), field("discount")); - -``` +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts two expressions. Signature: @@ -7823,12 +7320,23 @@ export declare function subtract(left: Expression, right: Expression): FunctionE | Parameter | Type | Description | | --- | --- | --- | | left | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract from. | -| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract. A new representing the subtraction operation. | +| right | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to subtract. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the subtraction operation. + +### Example + + +```typescript +// Subtract the 'discount' field from the 'price' field +subtract(field("price"), field("discount")); + +``` + ## function(mapExpr, ...) ### mapRemove(mapExpr, key) {:#mapremove_23c7d51} @@ -7838,12 +7346,6 @@ export declare function subtract(left: Expression, right: Expression): FunctionE Creates an expression that removes a key from the map produced by evaluating an expression. -``` -// Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), 'baz'); - -``` - Signature: ```typescript @@ -7861,19 +7363,23 @@ export declare function mapRemove(mapExpr: Expression, key: string): FunctionExp [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### mapRemove(mapExpr, keyExpr) {:#mapremove_9fbcaa3} - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes a key from the map produced by evaluating an expression. ``` // Removes the key 'baz' from the input map. -mapRemove(map({foo: 'bar', baz: true}), constant('baz')); +mapRemove(map({foo: 'bar', baz: true}), 'baz'); +@example ``` +### mapRemove(mapExpr, keyExpr) {:#mapremove_9fbcaa3} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes a key from the map produced by evaluating an expression. + Signature: ```typescript @@ -7891,6 +7397,16 @@ export declare function mapRemove(mapExpr: Expression, keyExpr: Expression): Fun [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +### Example + + +``` +// Removes the key 'baz' from the input map. +mapRemove(map({foo: 'bar', baz: true}), constant('baz')); +@example + +``` + ## function(mapExpression, ...) ### mapGet(mapExpression, subField) {:#mapget_688c050} @@ -7900,12 +7416,6 @@ export declare function mapRemove(mapExpr: Expression, keyExpr: Expression): Fun Accesses a value from a map (object) expression using the provided key. -```typescript -// Get the 'city' value from the 'address' map field -mapGet(field("address"), "city"); - -``` - Signature: ```typescript @@ -7917,12 +7427,23 @@ export declare function mapGet(mapExpression: Expression, subField: string): Fun | Parameter | Type | Description | | --- | --- | --- | | mapExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the map. | -| subField | string | The key to access in the map. A new representing the value associated with the given key in the map. | +| subField | string | The key to access in the map. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the value associated with the given key in the map. + +### Example + + +```typescript +// Get the 'city' value from the 'address' map field +mapGet(field("address"), "city"); + +``` + ## function(mapField, ...) ### mapMerge(mapField, secondMap, otherMaps) {:#mapmerge_70a564b} @@ -7932,13 +7453,6 @@ export declare function mapGet(mapExpression: Expression, subField: string): Fun Creates an expression that merges multiple map values. -``` -// Merges the map in the settings field with, a map literal, and a map in -// that is conditionally returned by another expression -mapMerge('settings', { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) - -``` - Signature: ```typescript @@ -7957,6 +7471,16 @@ export declare function mapMerge(mapField: string, secondMap: Record This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -7964,12 +7488,6 @@ export declare function mapMerge(mapField: string, secondMap: RecordSignature: ```typescript @@ -7987,19 +7505,22 @@ export declare function mapRemove(mapField: string, key: string): FunctionExpres [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### mapRemove(mapField, keyExpr) {:#mapremove_8406d13} - -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes a key from the map at the specified field name. ``` // Removes the key 'city' field from the map in the address field of the input document. -mapRemove('address', constant('city')); +mapRemove('address', 'city'); ``` +### mapRemove(mapField, keyExpr) {:#mapremove_8406d13} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes a key from the map at the specified field name. + Signature: ```typescript @@ -8017,6 +7538,15 @@ export declare function mapRemove(mapField: string, keyExpr: Expression): Functi [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +### Example + + +``` +// Removes the key 'city' field from the map in the address field of the input document. +mapRemove('address', constant('city')); + +``` + ## function(name, ...) ### field(name) {:#field_1eaaff4} @@ -8024,19 +7554,10 @@ export declare function mapRemove(mapField: string, keyExpr: Expression): Functi > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates a instance representing the field at the given path. +Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path. The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field (e.g., "address.city"). -```typescript -// Create a Field instance for the 'title' field -const titleField = field("title"); - -// Create a Field instance for a nested field 'author.firstName' -const authorFirstNameField = field("author.firstName"); - -``` - Signature: ```typescript @@ -8047,12 +7568,26 @@ export declare function field(name: string): Field; | Parameter | Type | Description | | --- | --- | --- | -| name | string | The path to the field. A new instance representing the specified field. | +| name | string | The path to the field. | Returns: [Field](./firestore_pipelines.field.md#field_class) +A new [Field](./firestore_pipelines.field.md#field_class) instance representing the specified field. + +### Example + + +```typescript +// Create a Field instance for the 'title' field +const titleField = field("title"); + +// Create a Field instance for a nested field 'author.firstName' +const authorFirstNameField = field("author.firstName"); + +``` + ## function(options, ...) ### execute(options) {:#execute_9e87e31} @@ -8064,20 +7599,9 @@ Executes a pipeline and returns a Promise to represent the asynchronous operatio The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously. -The pipeline results are returned as a that contains a list of objects. Each typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example: - -

  • If there are no stages or only transformation stages, each represents a single document.
  • If there is an aggregation, only a single is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each represents a distinct group and its associated aggregated values.
- -

Example: - -```typescript -const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") - .where(gt(field("rating"), 4.5)) - .select("title", "author", "rating")); - -const results: PipelineResults = snapshot.results; +The pipeline results are returned as a [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) that contains a list of [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects. Each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example: -``` +

  • If there are no stages or only transformation stages, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a single document.
  • If there is an aggregation, only a single [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a distinct group and its associated aggregated values.
Signature: @@ -8089,12 +7613,26 @@ export declare function execute(options: PipelineExecuteOptions): PromiseReturns: Promise<[PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class)> +A Promise representing the asynchronous pipeline execution. + +### Example + + +```typescript +const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") + .where(gt(field("rating"), 4.5)) + .select("title", "author", "rating")); + +const results: PipelineResults = snapshot.results; + +``` + ## function(path, ...) ### field(path) {:#field_34ee07d} @@ -8102,7 +7640,7 @@ Promise<[PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipeline > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Creates a instance representing the field at the given path. +Creates a [Field](./firestore_pipelines.field.md#field_class) instance representing the field at the given path. Signature: @@ -8114,12 +7652,14 @@ export declare function field(path: FieldPath): Field; | Parameter | Type | Description | | --- | --- | --- | -| path | [FieldPath](./firestore_.fieldpath.md#fieldpath_class) | A FieldPath specifying the field. A new instance representing the specified field. | +| path | [FieldPath](./firestore_.fieldpath.md#fieldpath_class) | A FieldPath specifying the field. | Returns: [Field](./firestore_pipelines.field.md#field_class) +A new [Field](./firestore_pipelines.field.md#field_class) instance representing the specified field. + ## function(pipeline, ...) ### execute(pipeline) {:#execute_01df620} @@ -8131,11 +7671,30 @@ Executes a pipeline and returns a Promise to represent the asynchronous operatio The returned Promise can be used to track the progress of the pipeline execution and retrieve the results (or handle any errors) asynchronously. -The pipeline results are returned as a that contains a list of objects. Each typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example: +The pipeline results are returned as a [PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class) that contains a list of [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects. Each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) typically represents a single key/value map that has passed through all the stages of the pipeline, however this might differ depending on the stages involved in the pipeline. For example: + +
  • If there are no stages or only transformation stages, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a single document.
  • If there is an aggregation, only a single [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) represents a distinct group and its associated aggregated values.
+ +Signature: + +```typescript +export declare function execute(pipeline: Pipeline): Promise; +``` + +#### Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| pipeline | [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) | The pipeline to execute. | + +Returns: + +Promise<[PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class)> + +A Promise representing the asynchronous pipeline execution. -
  • If there are no stages or only transformation stages, each represents a single document.
  • If there is an aggregation, only a single is returned, representing the aggregated results over the entire dataset .
  • If there is an aggregation stage with grouping, each represents a distinct group and its associated aggregated values.
+### Example -

Example: ```typescript const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") @@ -8146,30 +7705,35 @@ const results: PipelineResults = snapshot.results; ``` +## function(stringExpression, ...) + +### charLength(stringExpression) {:#charlength_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the character length of a string expression in UTF-8. + Signature: ```typescript -export declare function execute(pipeline: Pipeline): Promise; +export declare function charLength(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| pipeline | [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) | The pipeline to execute. A Promise representing the asynchronous pipeline execution. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to calculate the length of. | Returns: -Promise<[PipelineSnapshot](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshot_class)> - -## function(stringExpression, ...) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### charLength(stringExpression) {:#charlength_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the character length of a string expression in UTF-8. ```typescript // Get the character length of the 'name' field in UTF-8. @@ -8177,28 +7741,34 @@ strLength(field("name")); ``` +### endsWith(stringExpression, suffix) {:#endswith_0a0b889} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression ends with a given postfix. + Signature: ```typescript -export declare function charLength(stringExpression: Expression): FunctionExpression; +export declare function endsWith(stringExpression: Expression, suffix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to calculate the length of. A new representing the length of the string. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | +| suffix | string | The postfix to check for. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(stringExpression, suffix) {:#endswith_0a0b889} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression ends with a given postfix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." @@ -8206,10 +7776,17 @@ endsWith(field("fullName"), "Jr."); ``` +### endsWith(stringExpression, suffix) {:#endswith_13aee0d} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression ends with a given postfix. + Signature: ```typescript -export declare function endsWith(stringExpression: Expression, suffix: string): BooleanExpression; +export declare function endsWith(stringExpression: Expression, suffix: Expression): BooleanExpression; ``` #### Parameters @@ -8217,18 +7794,16 @@ export declare function endsWith(stringExpression: Expression, suffix: string): | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | -| suffix | string | The postfix to check for. A new representing the 'ends with' comparison. | +| suffix | [Expression](./firestore_pipelines.expression.md#expression_class) | The postfix to check for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### endsWith(stringExpression, suffix) {:#endswith_13aee0d} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ends with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression ends with a given postfix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." @@ -8236,29 +7811,34 @@ endsWith(field("fullName"), constant("Jr.")); ``` +### like(stringExpression, pattern) {:#like_a84c581} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison. + Signature: ```typescript -export declare function endsWith(stringExpression: Expression, suffix: Expression): BooleanExpression; +export declare function like(stringExpression: Expression, pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | -| suffix | [Expression](./firestore_pipelines.expression.md#expression_class) | The postfix to check for. A new representing the 'ends with' comparison. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | +| pattern | string | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### like(stringExpression, pattern) {:#like_a84c581} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison. ```typescript // Check if the 'title' field contains the string "guide" @@ -8266,10 +7846,17 @@ like(field("title"), "%guide%"); ``` +### like(stringExpression, pattern) {:#like_b534848} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that performs a case-sensitive wildcard string comparison. + Signature: ```typescript -export declare function like(stringExpression: Expression, pattern: string): BooleanExpression; +export declare function like(stringExpression: Expression, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -8277,29 +7864,34 @@ export declare function like(stringExpression: Expression, pattern: string): Boo | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | string | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### like(stringExpression, pattern) {:#like_b534848} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'like' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that performs a case-sensitive wildcard string comparison. ```typescript // Check if the 'title' field contains the string "guide" like(field("title"), field("pattern")); -``` +``` + +### regexContains(stringExpression, pattern) {:#regexcontains_a84c581} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a specified regular expression as a substring. Signature: ```typescript -export declare function like(stringExpression: Expression, pattern: Expression): BooleanExpression; +export declare function regexContains(stringExpression: Expression, pattern: string): BooleanExpression; ``` #### Parameters @@ -8307,18 +7899,16 @@ export declare function like(stringExpression: Expression, pattern: Expression): | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The pattern to search for. You can use "%" as a wildcard character. A new representing the 'like' comparison. | +| pattern | string | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(stringExpression, pattern) {:#regexcontains_a84c581} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) @@ -8326,10 +7916,17 @@ regexContains(field("description"), "(?i)example"); ``` +### regexContains(stringExpression, pattern) {:#regexcontains_b534848} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a specified regular expression as a substring. + Signature: ```typescript -export declare function regexContains(stringExpression: Expression, pattern: string): BooleanExpression; +export declare function regexContains(stringExpression: Expression, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -8337,18 +7934,16 @@ export declare function regexContains(stringExpression: Expression, pattern: str | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | string | The regular expression to use for the search. A new representing the 'contains' comparison. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the search. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexContains(stringExpression, pattern) {:#regexcontains_b534848} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a specified regular expression as a substring. ```typescript // Check if the 'description' field contains "example" (case-insensitive) @@ -8356,29 +7951,34 @@ regexContains(field("description"), field("pattern")); ``` +### regexMatch(stringExpression, pattern) {:#regexmatch_a84c581} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression matches a specified regular expression. + Signature: ```typescript -export declare function regexContains(stringExpression: Expression, pattern: Expression): BooleanExpression; +export declare function regexMatch(stringExpression: Expression, pattern: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the search. A new representing the 'contains' comparison. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to match against. | +| pattern | string | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(stringExpression, pattern) {:#regexmatch_a84c581} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -8386,10 +7986,17 @@ regexMatch(field("email"), "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); ``` +### regexMatch(stringExpression, pattern) {:#regexmatch_b534848} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression matches a specified regular expression. + Signature: ```typescript -export declare function regexMatch(stringExpression: Expression, pattern: string): BooleanExpression; +export declare function regexMatch(stringExpression: Expression, pattern: Expression): BooleanExpression; ``` #### Parameters @@ -8397,18 +8004,16 @@ export declare function regexMatch(stringExpression: Expression, pattern: string | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to match against. | -| pattern | string | The regular expression to use for the match. A new representing the regular expression match. | +| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the match. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### regexMatch(stringExpression, pattern) {:#regexmatch_b534848} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the regular expression match. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression matches a specified regular expression. ```typescript // Check if the 'email' field matches a valid email pattern @@ -8416,29 +8021,33 @@ regexMatch(field("email"), field("pattern")); ``` +### reverse(stringExpression) {:#reverse_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string. + Signature: ```typescript -export declare function regexMatch(stringExpression: Expression, pattern: Expression): BooleanExpression; +export declare function reverse(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to match against. | -| pattern | [Expression](./firestore_pipelines.expression.md#expression_class) | The regular expression to use for the match. A new representing the regular expression match. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### reverse(stringExpression) {:#reverse_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string. ```typescript // Reverse the value of the 'myString' field. @@ -8446,28 +8055,34 @@ reverse(field("myString")); ``` +### startsWith(stringExpression, prefix) {:#startswith_75c3dbb} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression starts with a given prefix. + Signature: ```typescript -export declare function reverse(stringExpression: Expression): FunctionExpression; +export declare function startsWith(stringExpression: Expression, prefix: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. A new representing the reversed string. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | +| prefix | string | The prefix to check for. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### startsWith(stringExpression, prefix) {:#startswith_75c3dbb} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression starts with a given prefix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." @@ -8475,10 +8090,17 @@ startsWith(field("fullName"), "Mr."); ``` +### startsWith(stringExpression, prefix) {:#startswith_52f218a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression starts with a given prefix. + Signature: ```typescript -export declare function startsWith(stringExpression: Expression, prefix: string): BooleanExpression; +export declare function startsWith(stringExpression: Expression, prefix: Expression): BooleanExpression; ``` #### Parameters @@ -8486,18 +8108,16 @@ export declare function startsWith(stringExpression: Expression, prefix: string) | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | -| prefix | string | The prefix to check for. A new representing the 'starts with' comparison. | +| prefix | [Expression](./firestore_pipelines.expression.md#expression_class) | The prefix to check for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### startsWith(stringExpression, prefix) {:#startswith_52f218a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'starts with' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression starts with a given prefix. ```typescript // Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." @@ -8505,29 +8125,34 @@ startsWith(field("fullName"), field("prefix")); ``` +### stringContains(stringExpression, substring) {:#stringcontains_3e9ff32} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a specified substring. + Signature: ```typescript -export declare function startsWith(stringExpression: Expression, prefix: Expression): BooleanExpression; +export declare function stringContains(stringExpression: Expression, substring: string): BooleanExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | -| prefix | [Expression](./firestore_pipelines.expression.md#expression_class) | The prefix to check for. A new representing the 'starts with' comparison. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | +| substring | string | The substring to search for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### stringContains(stringExpression, substring) {:#stringcontains_3e9ff32} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a specified substring. ```typescript // Check if the 'description' field contains "example". @@ -8535,10 +8160,17 @@ stringContains(field("description"), "example"); ``` +### stringContains(stringExpression, substring) {:#stringcontains_cc6ee02} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a string expression contains a substring specified by another expression. + Signature: ```typescript -export declare function stringContains(stringExpression: Expression, substring: string): BooleanExpression; +export declare function stringContains(stringExpression: Expression, substring: Expression): BooleanExpression; ``` #### Parameters @@ -8546,18 +8178,16 @@ export declare function stringContains(stringExpression: Expression, substring: | Parameter | Type | Description | | --- | --- | --- | | stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| substring | string | The substring to search for. A new representing the 'contains' comparison. | +| substring | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the substring to search for. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### stringContains(stringExpression, substring) {:#stringcontains_cc6ee02} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'contains' comparison. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a string expression contains a substring specified by another expression. ```typescript // Check if the 'description' field contains the value of the 'keyword' field. @@ -8565,29 +8195,33 @@ stringContains(field("description"), field("keyword")); ``` +### stringReverse(stringExpression) {:#stringreverse_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that reverses a string. + Signature: ```typescript -export declare function stringContains(stringExpression: Expression, substring: Expression): BooleanExpression; +export declare function stringReverse(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to perform the comparison on. | -| substring | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the substring to search for. A new representing the 'contains' comparison. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. | Returns: -[BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### stringReverse(stringExpression) {:#stringreverse_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the reversed string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that reverses a string. ```typescript // Reverse the value of the 'myString' field. @@ -8595,28 +8229,33 @@ strReverse(field("myString")); ``` +### toLower(stringExpression) {:#tolower_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string expression to lowercase. + Signature: ```typescript -export declare function stringReverse(stringExpression: Expression): FunctionExpression; +export declare function toLower(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluating to a string value, which will be reversed. A new representing the reversed string. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to convert to lowercase. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### toLower(stringExpression) {:#tolower_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the lowercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string expression to lowercase. ```typescript // Convert the 'name' field to lowercase @@ -8624,28 +8263,33 @@ toLower(field("name")); ``` +### toUpper(stringExpression) {:#toupper_c25a54a} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that converts a string expression to uppercase. + Signature: ```typescript -export declare function toLower(stringExpression: Expression): FunctionExpression; +export declare function toUpper(stringExpression: Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to convert to lowercase. A new representing the lowercase string. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to convert to uppercase. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### toUpper(stringExpression) {:#toupper_c25a54a} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the uppercase string. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that converts a string expression to uppercase. ```typescript // Convert the 'title' field to uppercase @@ -8653,28 +8297,34 @@ toUppercase(field("title")); ``` +### trim(stringExpression, valueToTrim) {:#trim_dd54322} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that removes leading and trailing characters from a string or byte array expression. + Signature: ```typescript -export declare function toUpper(stringExpression: Expression): FunctionExpression; +export declare function trim(stringExpression: Expression, valueToTrim?: string | Expression): FunctionExpression; ``` #### Parameters | Parameter | Type | Description | | --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string to convert to uppercase. A new representing the uppercase string. | +| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string or byte array to trim. | +| valueToTrim | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### trim(stringExpression, valueToTrim) {:#trim_dd54322} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the trimmed string or byte array. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that removes leading and trailing characters from a string or byte array expression. ```typescript // Trim whitespace from the 'userInput' field @@ -8685,23 +8335,6 @@ trim(field("userInput"), '"'); ``` -Signature: - -```typescript -export declare function trim(stringExpression: Expression, valueToTrim?: string | Expression): FunctionExpression; -``` - -#### Parameters - -| Parameter | Type | Description | -| --- | --- | --- | -| stringExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the string or byte array to trim. | -| valueToTrim | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | Optional This parameter is treated as a set of characters or bytes that will be trimmed from the input. If not specified, then whitespace will be trimmed. A new representing the trimmed string or byte array. | - -Returns: - -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) - ## function(timestamp, ...) ### timestampAdd(timestamp, unit, amount) {:#timestampadd_98418f9} @@ -8711,12 +8344,6 @@ export declare function trim(stringExpression: Expression, valueToTrim?: string Creates an expression that adds a specified amount of time to a timestamp. -```typescript -// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. -timestampAdd(field("timestamp"), field("unit"), field("amount")); - -``` - Signature: ```typescript @@ -8729,25 +8356,30 @@ export declare function timestampAdd(timestamp: Expression, unit: Expression, am | --- | --- | --- | | timestamp | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampAdd(timestamp, unit, amount) {:#timestampadd_ffe8e57} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that adds a specified amount of time to a timestamp. ```typescript -// Add 1 day to the 'timestamp' field. -timestampAdd(field("timestamp"), "day", 1); +// Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. +timestampAdd(field("timestamp"), field("unit"), field("amount")); ``` +### timestampAdd(timestamp, unit, amount) {:#timestampadd_ffe8e57} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that adds a specified amount of time to a timestamp. + Signature: ```typescript @@ -8760,25 +8392,30 @@ export declare function timestampAdd(timestamp: Expression, unit: 'microsecond' | --- | --- | --- | | timestamp | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to add (e.g., "day", "hour"). | -| amount | number | The amount of time to add. A new representing the resulting timestamp. | +| amount | number | The amount of time to add. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### timestampSubtract(timestamp, unit, amount) {:#timestampsubtract_98418f9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that subtracts a specified amount of time from a timestamp. ```typescript -// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. -timestampSubtract(field("timestamp"), field("unit"), field("amount")); +// Add 1 day to the 'timestamp' field. +timestampAdd(field("timestamp"), "day", 1); ``` +### timestampSubtract(timestamp, unit, amount) {:#timestampsubtract_98418f9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that subtracts a specified amount of time from a timestamp. + Signature: ```typescript @@ -8791,11 +8428,22 @@ export declare function timestampSubtract(timestamp: Expression, unit: Expressio | --- | --- | --- | | timestamp | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. | -| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. A new representing the resulting timestamp. | +| amount | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression evaluates to amount of the unit. | Returns: -[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +[FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) + +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. + +### Example + + +```typescript +// Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. +timestampSubtract(field("timestamp"), field("unit"), field("amount")); + +``` ### timestampSubtract(timestamp, unit, amount) {:#timestampsubtract_ffe8e57} @@ -8804,12 +8452,6 @@ export declare function timestampSubtract(timestamp: Expression, unit: Expressio Creates an expression that subtracts a specified amount of time from a timestamp. -```typescript -// Subtract 1 day from the 'timestamp' field. -timestampSubtract(field("timestamp"), "day", 1); - -``` - Signature: ```typescript @@ -8822,12 +8464,23 @@ export declare function timestampSubtract(timestamp: Expression, unit: 'microsec | --- | --- | --- | | timestamp | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the timestamp. | | unit | 'microsecond' \| 'millisecond' \| 'second' \| 'minute' \| 'hour' \| 'day' | The unit of time to subtract (e.g., "day", "hour"). | -| amount | number | The amount of time to subtract. A new representing the resulting timestamp. | +| amount | number | The amount of time to subtract. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the resulting timestamp. + +### Example + + +```typescript +// Subtract 1 day from the 'timestamp' field. +timestampSubtract(field("timestamp"), "day", 1); + +``` + ## function(timestampExpression, ...) ### timestampTruncate(timestampExpression, granularity, timezone) {:#timestamptruncate_ad5d843} @@ -8849,12 +8502,14 @@ export declare function timestampTruncate(timestampExpression: Expression, granu | --- | --- | --- | | timestampExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | Truncate the timestamp value that is returned by this expression. | | granularity | [TimeGranularity](./firestore_pipelines.md#timegranularity) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -8883,12 +8538,14 @@ export declare function timestampTruncate(timestampExpression: Expression, granu | --- | --- | --- | | timestampExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | Truncate the timestamp value that is returned by this expression. | | granularity | [Expression](./firestore_pipelines.expression.md#expression_class) | The granularity to truncate to. | -| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". A new {Expression} representing the truncated timestamp. | +| timezone | string \| [Expression](./firestore_pipelines.expression.md#expression_class) | The timezone to use for truncation. Valid values are from the TZ database (e.g., "America/Los\_Angeles") or in the format "Etc/GMT-1". | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new `Expression` representing the truncated timestamp. + ### Example @@ -8909,13 +8566,6 @@ Creates an expression that returns the `catch` argument if there is an error, el This overload is useful when a BooleanExpression is required. -```typescript -// Create an expression that protects against a divide by zero error -// but always returns a boolean expression. -ifError(constant(50).divide('length').gt(1), constant(false)); - -``` - Signature: ```typescript @@ -8927,26 +8577,31 @@ export declare function ifError(tryExpr: BooleanExpression, catchExpr: BooleanEx | Parameter | Type | Description | | --- | --- | --- | | tryExpr | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The try expression. | -| catchExpr | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. A new representing the 'ifError' operation. | +| catchExpr | [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### ifError(tryExpr, catchExpr) {:#iferror_756c12e} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. ```typescript -// Returns the first item in the title field arrays, or returns -// the entire title field if the array is empty or the field is another type. -ifError(field("title").arrayGet(0), field("title")); +// Create an expression that protects against a divide by zero error +// but always returns a boolean expression. +ifError(constant(50).divide('length').gt(1), constant(false)); ``` +### ifError(tryExpr, catchExpr) {:#iferror_756c12e} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. + Signature: ```typescript @@ -8958,26 +8613,31 @@ export declare function ifError(tryExpr: Expression, catchExpr: Expression): Fun | Parameter | Type | Description | | --- | --- | --- | | tryExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The try expression. | -| catchExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. A new representing the 'ifError' operation. | +| catchExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The catch expression that will be evaluated and returned if the tryExpr produces an error. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### ifError(tryExpr, catchValue) {:#iferror_dc532f9} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. ```typescript // Returns the first item in the title field arrays, or returns -// "Default Title" -ifError(field("title").arrayGet(0), "Default Title"); +// the entire title field if the array is empty or the field is another type. +ifError(field("title").arrayGet(0), field("title")); ``` +### ifError(tryExpr, catchValue) {:#iferror_dc532f9} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns the `catch` argument if there is an error, else return the result of the `try` argument evaluation. + Signature: ```typescript @@ -8989,12 +8649,24 @@ export declare function ifError(tryExpr: Expression, catchValue: unknown): Funct | Parameter | Type | Description | | --- | --- | --- | | tryExpr | [Expression](./firestore_pipelines.expression.md#expression_class) | The try expression. | -| catchValue | unknown | The value that will be returned if the tryExpr produces an error. A new representing the 'ifError' operation. | +| catchValue | unknown | The value that will be returned if the tryExpr produces an error. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'ifError' operation. + +### Example + + +```typescript +// Returns the first item in the title field arrays, or returns +// "Default Title" +ifError(field("title").arrayGet(0), "Default Title"); + +``` + ## function(value, ...) ### constant(value) {:#constant_0c00f91} @@ -9014,12 +8686,14 @@ export declare function constant(value: number): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | number | The number value. A new Constant instance. | +| value | number | The number value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_6dac335} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9037,12 +8711,14 @@ export declare function constant(value: VectorValue): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The VectorValue value. A new Constant instance. | +| value | [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The VectorValue value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_7c807cd} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9060,12 +8736,14 @@ export declare function constant(value: string): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | string | The string value. A new Constant instance. | +| value | string | The string value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_b2e4f8d} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9083,12 +8761,14 @@ export declare function constant(value: boolean): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | boolean | The boolean value. A new Constant instance. | +| value | boolean | The boolean value. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A new `Constant` instance. + ### constant(value) {:#constant_73ebd84} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9106,12 +8786,14 @@ export declare function constant(value: null): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | null | The null value. A new Constant instance. | +| value | null | The null value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_72a76cb} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9129,12 +8811,14 @@ export declare function constant(value: GeoPoint): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [GeoPoint](./firestore_.geopoint.md#geopoint_class) | The GeoPoint value. A new Constant instance. | +| value | [GeoPoint](./firestore_.geopoint.md#geopoint_class) | The GeoPoint value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_000477d} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9152,12 +8836,14 @@ export declare function constant(value: Timestamp): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Timestamp](./firestore_.timestamp.md#timestamp_class) | The Timestamp value. A new Constant instance. | +| value | [Timestamp](./firestore_.timestamp.md#timestamp_class) | The Timestamp value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_5131bf7} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9175,12 +8861,14 @@ export declare function constant(value: Date): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | Date | The Date value. A new Constant instance. | +| value | Date | The Date value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_fdf565d} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9198,12 +8886,14 @@ export declare function constant(value: Bytes): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Bytes](./firestore_.bytes.md#bytes_class) | The Bytes value. A new Constant instance. | +| value | [Bytes](./firestore_.bytes.md#bytes_class) | The Bytes value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### constant(value) {:#constant_bcd2b0b} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9221,12 +8911,14 @@ export declare function constant(value: DocumentReference): Expression; | Parameter | Type | Description | | --- | --- | --- | -| value | [DocumentReference](./firestore_.documentreference.md#documentreference_class) | The DocumentReference value. A new Constant instance. | +| value | [DocumentReference](./firestore_.documentreference.md#documentreference_class) | The DocumentReference value. | Returns: [Expression](./firestore_pipelines.expression.md#expression_class) +A new `Constant` instance. + ### exists(value) {:#exists_f3daf14} > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. @@ -9234,12 +8926,6 @@ export declare function constant(value: DocumentReference): Expression; Creates an expression that checks if a field exists. -```typescript -// Check if the document has a field named "phoneNumber" -exists(field("phoneNumber")); - -``` - Signature: ```typescript @@ -9250,25 +8936,30 @@ export declare function exists(value: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluates to the name of the field to check. A new representing the 'exists' check. | +| value | [Expression](./firestore_pipelines.expression.md#expression_class) | An expression evaluates to the name of the field to check. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### isAbsent(value) {:#isabsent_f3daf14} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'exists' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that returns `true` if a value is absent. Otherwise, returns `false` even if the value is `null`. ```typescript -// Check if the field `value` is absent. -isAbsent(field("value")); +// Check if the document has a field named "phoneNumber" +exists(field("phoneNumber")); ``` +### isAbsent(value) {:#isabsent_f3daf14} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that returns `true` if a value is absent. Otherwise, returns `false` even if the value is `null`. + Signature: ```typescript @@ -9279,25 +8970,30 @@ export declare function isAbsent(value: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. A new representing the 'isAbsent' check. | +| value | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) -### isError(value) {:#iserror_f3daf14} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'isAbsent' check. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that checks if a given expression produces an error. ```typescript -// Check if the result of a calculation is an error -isError(field("title").arrayContains(1)); +// Check if the field `value` is absent. +isAbsent(field("value")); ``` +### isError(value) {:#iserror_f3daf14} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that checks if a given expression produces an error. + Signature: ```typescript @@ -9308,12 +9004,23 @@ export declare function isError(value: Expression): BooleanExpression; | Parameter | Type | Description | | --- | --- | --- | -| value | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. A new representing the 'isError' check. | +| value | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression to check. | Returns: [BooleanExpression](./firestore_pipelines.booleanexpression.md#booleanexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the 'isError' check. + +### Example + + +```typescript +// Check if the result of a calculation is an error +isError(field("title").arrayContains(1)); + +``` + ## function(vectorExpression, ...) ### cosineDistance(vectorExpression, vector) {:#cosinedistance_3a80317} @@ -9323,12 +9030,6 @@ export declare function isError(value: Expression): BooleanExpression; Calculates the Cosine distance between a vector expression and a vector literal. -```typescript -// Calculate the cosine distance between the 'location' field and a target location -cosineDistance(field("location"), [37.7749, -122.4194]); - -``` - Signature: ```typescript @@ -9339,26 +9040,31 @@ export declare function cosineDistance(vectorExpression: Expression, vector: num | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. A new representing the cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### cosineDistance(vectorExpression, otherVectorExpression) {:#cosinedistance_17b5bcc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Cosine distance between two vector expressions. ```typescript -// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field -cosineDistance(field("userVector"), field("itemVector")); +// Calculate the cosine distance between the 'location' field and a target location +cosineDistance(field("location"), [37.7749, -122.4194]); ``` +### cosineDistance(vectorExpression, otherVectorExpression) {:#cosinedistance_17b5bcc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Cosine distance between two vector expressions. + Signature: ```typescript @@ -9369,26 +9075,31 @@ export declare function cosineDistance(vectorExpression: Expression, otherVector | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| otherVectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the cosine distance between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| otherVectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(vectorExpression, vector) {:#dotproduct_3a80317} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the cosine distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between a vector expression and a double array. ```typescript -// Calculate the dot product between a feature vector and a target vector -dotProduct(field("features"), [0.5, 0.8, 0.2]); +// Calculate the cosine distance between the 'userVector' field and the 'itemVector' field +cosineDistance(field("userVector"), field("itemVector")); ``` +### dotProduct(vectorExpression, vector) {:#dotproduct_3a80317} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between a vector expression and a double array. + Signature: ```typescript @@ -9399,26 +9110,31 @@ export declare function dotProduct(vectorExpression: Expression, vector: number[ | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to calculate with. | -| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. A new representing the dot product between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to calculate with. | +| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to calculate with. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### dotProduct(vectorExpression, otherVectorExpression) {:#dotproduct_17b5bcc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the dot product between two vector expressions. ```typescript -// Calculate the dot product between two document vectors: 'docVector1' and 'docVector2' -dotProduct(field("docVector1"), field("docVector2")); +// Calculate the dot product between a feature vector and a target vector +dotProduct(field("features"), [0.5, 0.8, 0.2]); ``` +### dotProduct(vectorExpression, otherVectorExpression) {:#dotproduct_17b5bcc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the dot product between two vector expressions. + Signature: ```typescript @@ -9429,27 +9145,31 @@ export declare function dotProduct(vectorExpression: Expression, otherVectorExpr | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to calculate with. | -| otherVectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to calculate with. A new representing the dot product between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to calculate with. | +| otherVectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to calculate with. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(vectorExpression, vector) {:#euclideandistance_3a80317} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the dot product between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between a vector expression and a double array. ```typescript -// Calculate the Euclidean distance between the 'location' field and a target location - -euclideanDistance(field("location"), [37.7749, -122.4194]); +// Calculate the dot product between two document vectors: 'docVector1' and 'docVector2' +dotProduct(field("docVector1"), field("docVector2")); ``` +### euclideanDistance(vectorExpression, vector) {:#euclideandistance_3a80317} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between a vector expression and a double array. + Signature: ```typescript @@ -9460,26 +9180,32 @@ export declare function euclideanDistance(vectorExpression: Expression, vector: | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. A new representing the Euclidean distance between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| vector | number\[\] \| [VectorValue](./firestore_.vectorvalue.md#vectorvalue_class) | The other vector (as an array of doubles or VectorValue) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### euclideanDistance(vectorExpression, otherVectorExpression) {:#euclideandistance_17b5bcc} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Calculates the Euclidean distance between two vector expressions. ```typescript -// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' -euclideanDistance(field("pointA"), field("pointB")); +// Calculate the Euclidean distance between the 'location' field and a target location + +euclideanDistance(field("location"), [37.7749, -122.4194]); ``` +### euclideanDistance(vectorExpression, otherVectorExpression) {:#euclideandistance_17b5bcc} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Calculates the Euclidean distance between two vector expressions. + Signature: ```typescript @@ -9490,26 +9216,31 @@ export declare function euclideanDistance(vectorExpression: Expression, otherVec | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expr) to compare against. | -| otherVectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expr) to compare against. A new representing the Euclidean distance between the two vectors. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The first vector (represented as an Expression) to compare against. | +| otherVectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The other vector (represented as an Expression) to compare against. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) -### vectorLength(vectorExpression) {:#vectorlength_58a039b} +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the Euclidean distance between the two vectors. -> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. -> +### Example -Creates an expression that calculates the length of a Firestore Vector. ```typescript -// Get the vector length (dimension) of the field 'embedding'. -vectorLength(field("embedding")); +// Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' +euclideanDistance(field("pointA"), field("pointB")); ``` +### vectorLength(vectorExpression) {:#vectorlength_58a039b} + +> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. +> + +Creates an expression that calculates the length of a Firestore Vector. + Signature: ```typescript @@ -9520,18 +9251,29 @@ export declare function vectorLength(vectorExpression: Expression): FunctionExpr | Parameter | Type | Description | | --- | --- | --- | -| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the Firestore Vector. A new representing the length of the array. | +| vectorExpression | [Expression](./firestore_pipelines.expression.md#expression_class) | The expression representing the Firestore Vector. | Returns: [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) +A new [Expression](./firestore_pipelines.expression.md#expression_class) representing the length of the array. + +### Example + + +```typescript +// Get the vector length (dimension) of the field 'embedding'. +vectorLength(field("embedding")); + +``` + ## AddFieldsStageOptions > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how an AddFieldsStage is evaluated. See . +Options defining how an AddFieldsStage is evaluated. See [Pipeline.addFields()](./firestore_pipelines.pipeline.md#pipelineaddfields). Signature: @@ -9546,7 +9288,7 @@ export declare type AddFieldsStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how an AggregateStage is evaluated. See . +Options defining how an AggregateStage is evaluated. See [Pipeline.aggregate()](./firestore_pipelines.pipeline.md#pipelineaggregate). Signature: @@ -9562,7 +9304,9 @@ export declare type AggregateStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Defines the configuration options for a within a pipeline. This type extends and provides specific settings for how a collection group is identified and processed during pipeline execution. +Defines the configuration options for a CollectionGroupStage within a pipeline. This type extends [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) and provides specific settings for how a collection group is identified and processed during pipeline execution. + +See [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup) to create a collection group stage. Signature: @@ -9578,7 +9322,7 @@ export declare type CollectionGroupStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a CollectionStage is evaluated. See . +Options defining how a CollectionStage is evaluated. See [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection). Signature: @@ -9594,7 +9338,7 @@ export declare type CollectionStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a DatabaseStage is evaluated. See . +Options defining how a DatabaseStage is evaluated. See [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase). Signature: @@ -9607,7 +9351,7 @@ export declare type DatabaseStageOptions = StageOptions & {}; > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a DistinctStage is evaluated. See . +Options defining how a DistinctStage is evaluated. See [Pipeline.distinct()](./firestore_pipelines.pipeline.md#pipelinedistinct). Signature: @@ -9622,7 +9366,7 @@ export declare type DistinctStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a DocumentsStage is evaluated. See . +Options defining how a DocumentsStage is evaluated. See [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments). Signature: @@ -9650,7 +9394,7 @@ export declare type ExpressionType = 'Field' | 'Constant' | 'Function' | 'Aggreg > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a FindNearestStage is evaluated. See . +Options defining how a FindNearestStage is evaluated. See [Pipeline.findNearest()](./firestore_pipelines.pipeline.md#pipelinefindnearest). Signature: @@ -9669,7 +9413,7 @@ export declare type FindNearestStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a LimitStage is evaluated. See . +Options defining how a LimitStage is evaluated. See [Pipeline.limit()](./firestore_pipelines.pipeline.md#pipelinelimit). Signature: @@ -9684,7 +9428,7 @@ export declare type LimitStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how an OffsetStage is evaluated. See . +Options defining how an OffsetStage is evaluated. See [Pipeline.offset()](./firestore_pipelines.pipeline.md#pipelineoffset). Signature: @@ -9701,8 +9445,6 @@ export declare type OffsetStageOptions = StageOptions & { Utility type to create an type that only allows one property of the Type param T to be set. -type XorY = OneOf<{ x: unknown, y: unknown}> let a = { x: "foo" } // OK let b = { y: "foo" } // OK let c = { a: "foo", y: "foo" } // Not OK - Signature: ```typescript @@ -9713,6 +9455,17 @@ export declare type OneOf = { }[keyof T]; ``` +### Example + + +``` +type XorY = OneOf<{ x: unknown, y: unknown }> +let a = { x: "foo" } // OK +let b = { y: "foo" } // OK +let c = { a: "foo", y: "foo" } // Not OK + +``` + ## PartialWithFieldValue Similar to TypeScript's `Partial`, but allows nested fields to be omitted and FieldValues to be passed in as property values. @@ -9740,7 +9493,7 @@ export declare type Primitive = string | number | boolean | undefined | null; > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a RemoveFieldsStage is evaluated. See . +Options defining how a RemoveFieldsStage is evaluated. See [Pipeline.removeFields()](./firestore_pipelines.pipeline.md#pipelineremovefields). Signature: @@ -9755,7 +9508,7 @@ export declare type RemoveFieldsStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a ReplaceWithStage is evaluated. See . +Options defining how a ReplaceWithStage is evaluated. See [Pipeline.replaceWith()](./firestore_pipelines.pipeline.md#pipelinereplacewith). Signature: @@ -9770,9 +9523,9 @@ export declare type ReplaceWithStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Defines the options for evaluating a sample stage within a pipeline. This type combines common with a specific configuration where only one of the defined sampling methods can be applied. +Defines the options for evaluating a sample stage within a pipeline. This type combines common [StageOptions](./firestore_pipelines.stageoptions.md#stageoptions_interface) with a specific configuration where only one of the defined sampling methods can be applied. -See to create a sample stage.. +See [Pipeline.sample()](./firestore_pipelines.pipeline.md#pipelinesample) to create a sample stage.. Signature: @@ -9788,7 +9541,7 @@ export declare type SampleStageOptions = StageOptions & OneOf<{ > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a SelectStage is evaluated. See . +Options defining how a SelectStage is evaluated. See [Pipeline.select()](./firestore_pipelines.pipeline.md#pipelineselect). Signature: @@ -9817,7 +9570,7 @@ export declare type SetOptions = { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a SortStage is evaluated. See . +Options defining how a SortStage is evaluated. See [Pipeline.sort()](./firestore_pipelines.pipeline.md#pipelinesort). Signature: @@ -9845,7 +9598,7 @@ export declare type TimeGranularity = 'microsecond' | 'millisecond' | 'second' | > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a UnionStage is evaluated. See . +Options defining how a UnionStage is evaluated. See [Pipeline.union()](./firestore_pipelines.pipeline.md#pipelineunion). Signature: @@ -9876,7 +9629,7 @@ export declare type UnnestStageOptions = StageOptions & { > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Options defining how a WhereStage is evaluated. See . +Options defining how a WhereStage is evaluated. See [Pipeline.where()](./firestore_pipelines.pipeline.md#pipelinewhere). Signature: diff --git a/docs-devsite/firestore_pipelines.pipelineexecuteoptions.md b/docs-devsite/firestore_pipelines.pipelineexecuteoptions.md index fc0ed90769..ed438bae0a 100644 --- a/docs-devsite/firestore_pipelines.pipelineexecuteoptions.md +++ b/docs-devsite/firestore_pipelines.pipelineexecuteoptions.md @@ -27,33 +27,7 @@ export declare interface PipelineExecuteOptions | --- | --- | --- | | [indexMode](./firestore_pipelines.pipelineexecuteoptions.md#pipelineexecuteoptionsindexmode) | 'recommended' | (Public Preview) Specify the index mode. | | [pipeline](./firestore_pipelines.pipelineexecuteoptions.md#pipelineexecuteoptionspipeline) | [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class) | (Public Preview) Pipeline to be evaluated. | -| [rawOptions](./firestore_pipelines.pipelineexecuteoptions.md#pipelineexecuteoptionsrawoptions) | { \[name: string\]: unknown; } | (Public Preview) An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).Custom option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.Values specified in rawOptions will take precedence over any options with the same name set by the SDK.Override the example_option: -``` - execute({ - pipeline: myPipeline, - rawOptions: { - // Override `example_option`. This will not - // merge with the existing `example_option` object. - "example_option": { - foo: "bar" - } - } - } - -``` -rawOptions supports dot notation, if you want to override a nested option. -``` - execute({ - pipeline: myPipeline, - rawOptions: { - // Override `example_option.foo` and do not override - // any other properties of `example_option`. - "example_option.foo": "bar" - } - } - -``` - | +| [rawOptions](./firestore_pipelines.pipelineexecuteoptions.md#pipelineexecuteoptionsrawoptions) | { \[name: string\]: unknown; } | (Public Preview) An escape hatch to set options not known at SDK build time. These values will be passed directly to the Firestore backend and not used by the SDK.The option name will be used as provided. And must match the name format used by the backend (hint: use a snake\_case\_name).Custom option values can be any type supported by Firestore (for example: string, boolean, number, map, …). Value types not known to the SDK will be rejected.Values specified in rawOptions will take precedence over any options with the same name set by the SDK. | ## PipelineExecuteOptions.indexMode @@ -94,6 +68,16 @@ Custom option values can be any type supported by Firestore (for example: string Values specified in rawOptions will take precedence over any options with the same name set by the SDK. +Signature: + +```typescript +rawOptions?: { + [name: string]: unknown; + }; +``` + +### Example 1 + Override the `example_option`: ``` @@ -109,6 +93,9 @@ Override the `example_option`: } ``` + +### Example 2 + `rawOptions` supports dot notation, if you want to override a nested option. ``` @@ -123,10 +110,3 @@ Override the `example_option`: ``` -Signature: - -```typescript -rawOptions?: { - [name: string]: unknown; - }; -``` diff --git a/docs-devsite/firestore_pipelines.pipelineresult.md b/docs-devsite/firestore_pipelines.pipelineresult.md index b5dfb1a41d..6a04334e14 100644 --- a/docs-devsite/firestore_pipelines.pipelineresult.md +++ b/docs-devsite/firestore_pipelines.pipelineresult.md @@ -13,7 +13,7 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the or methods. +A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the [PipelineResult.data()](./firestore_pipelines.pipelineresult.md#pipelineresultdata) or [PipelineResult.get()](./firestore_pipelines.pipelineresult.md#pipelineresultget) methods.

If the PipelineResult represents a non-document result, `ref` will return a undefined value. @@ -27,10 +27,10 @@ export declare class PipelineResult | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [createTime](./firestore_pipelines.pipelineresult.md#pipelineresultcreatetime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was created. Undefined if this result is not a document. {Timestamp\|undefined} | -| [id](./firestore_pipelines.pipelineresult.md#pipelineresultid) | | string \| undefined | (Public Preview) The ID of the document for which this PipelineResult contains data, if it is a document; otherwise undefined. {string} | +| [createTime](./firestore_pipelines.pipelineresult.md#pipelineresultcreatetime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was created. Undefined if this result is not a document. | +| [id](./firestore_pipelines.pipelineresult.md#pipelineresultid) | | string \| undefined | (Public Preview) The ID of the document for which this PipelineResult contains data, if it is a document; otherwise undefined. | | [ref](./firestore_pipelines.pipelineresult.md#pipelineresultref) | | [DocumentReference](./firestore_.documentreference.md#documentreference_class) \| undefined | (Public Preview) The reference of the document, if it is a document; otherwise undefined. | -| [updateTime](./firestore_pipelines.pipelineresult.md#pipelineresultupdatetime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. {Timestamp\|undefined} | +| [updateTime](./firestore_pipelines.pipelineresult.md#pipelineresultupdatetime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) \| undefined | (Public Preview) The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. | ## Methods @@ -46,8 +46,6 @@ export declare class PipelineResult The time the document was created. Undefined if this result is not a document. - {Timestamp\|undefined} - Signature: ```typescript @@ -61,8 +59,6 @@ get createTime(): Timestamp | undefined; The ID of the document for which this PipelineResult contains data, if it is a document; otherwise `undefined`. - {string} - Signature: ```typescript @@ -89,8 +85,6 @@ get ref(): DocumentReference | undefined; The time the document was last updated (at the time the snapshot was generated). Undefined if this result is not a document. - {Timestamp\|undefined} - Signature: ```typescript @@ -113,7 +107,7 @@ data(): AppModelType; AppModelType -{T} An object containing all fields in the document or 'undefined' if the document doesn't exist. +An object containing all fields in the document or 'undefined' if the document doesn't exist. ### Example @@ -151,7 +145,7 @@ get(fieldPath: string | FieldPath | Field): any; any -{\*} The data at the specified field location or undefined if no such field exists. +The data at the specified field location or `undefined` if no such field exists. ### Example diff --git a/docs-devsite/firestore_pipelines.pipelinesnapshot.md b/docs-devsite/firestore_pipelines.pipelinesnapshot.md index 7f6d4744f4..6aced9e047 100644 --- a/docs-devsite/firestore_pipelines.pipelinesnapshot.md +++ b/docs-devsite/firestore_pipelines.pipelinesnapshot.md @@ -15,7 +15,7 @@ https://github.com/firebase/firebase-js-sdk Represents the results of a Firestore pipeline execution. -A `PipelineSnapshot` contains zero or more objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. +A `PipelineSnapshot` contains zero or more [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class) objects representing the documents returned by a pipeline query. It provides methods to iterate over the documents and access metadata about the query results. Signature: @@ -33,7 +33,7 @@ export declare class PipelineSnapshot | Property | Modifiers | Type | Description | | --- | --- | --- | --- | -| [executionTime](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshotexecutiontime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) | (Public Preview) The time at which the pipeline producing this result is executed. {Timestamp} | +| [executionTime](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshotexecutiontime) | | [Timestamp](./firestore_.timestamp.md#timestamp_class) | (Public Preview) The time at which the pipeline producing this result is executed. | | [results](./firestore_pipelines.pipelinesnapshot.md#pipelinesnapshotresults) | | [PipelineResult](./firestore_pipelines.pipelineresult.md#pipelineresult_class)\[\] | (Public Preview) An array of all the results in the PipelineSnapshot. | ## PipelineSnapshot.(constructor) @@ -64,8 +64,6 @@ constructor(pipeline: Pipeline, results: PipelineResult[], executionTime?: Times The time at which the pipeline producing this result is executed. - {Timestamp} - Signature: ```typescript diff --git a/docs-devsite/firestore_pipelines.pipelinesource.md b/docs-devsite/firestore_pipelines.pipelinesource.md index 383f31f7fd..31c5192dfd 100644 --- a/docs-devsite/firestore_pipelines.pipelinesource.md +++ b/docs-devsite/firestore_pipelines.pipelinesource.md @@ -13,9 +13,9 @@ https://github.com/firebase/firebase-js-sdk > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > -Provides the entry point for defining the data source of a Firestore . +Provides the entry point for defining the data source of a Firestore [Pipeline](./firestore_pipelines.pipeline.md#pipeline_class). -Use the methods of this class (e.g., , , , or ) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. +Use the methods of this class (e.g., [PipelineSource.collection()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollection), [PipelineSource.collectionGroup()](./firestore_pipelines.pipelinesource.md#pipelinesourcecollectiongroup), [PipelineSource.database()](./firestore_pipelines.pipelinesource.md#pipelinesourcedatabase), or [PipelineSource.documents()](./firestore_pipelines.pipelinesource.md#pipelinesourcedocuments)) to specify the initial data for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. Signature: @@ -154,7 +154,7 @@ createFrom(query: Query): Pipeline; #### Exceptions - Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. +`FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. ## PipelineSource.database() @@ -220,7 +220,7 @@ PipelineType #### Exceptions - Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. +`FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. ## PipelineSource.documents() @@ -247,5 +247,5 @@ PipelineType #### Exceptions - Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. +`FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. diff --git a/docs-devsite/firestore_pipelines.vectorvalue.md b/docs-devsite/firestore_pipelines.vectorvalue.md index 8185645466..2b02bcea9f 100644 --- a/docs-devsite/firestore_pipelines.vectorvalue.md +++ b/docs-devsite/firestore_pipelines.vectorvalue.md @@ -12,8 +12,6 @@ https://github.com/firebase/firebase-js-sdk # VectorValue class Represents a vector type in Firestore documents. Create an instance with [vector()](./firestore_.md#vector_0dbdaf2). - VectorValue - Signature: ```typescript diff --git a/packages/firestore/src/api/aggregate.ts b/packages/firestore/src/api/aggregate.ts index 453f9e0a84..d747905106 100644 --- a/packages/firestore/src/api/aggregate.ts +++ b/packages/firestore/src/api/aggregate.ts @@ -55,7 +55,7 @@ export { * used. Every invocation of this function necessarily involves a round trip to * the server. * - * @param query The query whose result set size is calculated. + * @param query - The query whose result set size is calculated. * @returns A Promise that will be resolved with the count; the count can be * retrieved from `snapshot.data().count`, where `snapshot` is the * `AggregateQuerySnapshot` to which the returned Promise resolves. @@ -95,8 +95,8 @@ export function getCountFromServer< * used. Every invocation of this function necessarily involves a round trip to * the server. * - * @param query The query whose result set is aggregated over. - * @param aggregateSpec An `AggregateSpec` object that specifies the aggregates + * @param query - The query whose result set is aggregated over. + * @param aggregateSpec - An `AggregateSpec` object that specifies the aggregates * to perform over the result set. The AggregateSpec specifies aliases for each * aggregate, which can be used to retrieve the aggregate result. * @example @@ -147,7 +147,7 @@ export function getAggregateFromServer< * Converts the core aggregation result to an `AggregateQuerySnapshot` * that can be returned to the consumer. * @param query - * @param aggregateResult Core aggregation result + * @param aggregateResult - Core aggregation result * @internal */ function convertToAggregateQuerySnapshot< diff --git a/packages/firestore/src/api/cache_config.ts b/packages/firestore/src/api/cache_config.ts index 072c67ec7a..205888d36a 100644 --- a/packages/firestore/src/api/cache_config.ts +++ b/packages/firestore/src/api/cache_config.ts @@ -419,7 +419,7 @@ export type PersistentSingleTabManagerSettings = { /** * Creates an instance of `PersistentSingleTabManager`. * - * @param settings Configures the created tab manager. + * @param settings - Configures the created tab manager. */ export function persistentSingleTabManager( settings: PersistentSingleTabManagerSettings | undefined diff --git a/packages/firestore/src/api/persistent_cache_index_manager.ts b/packages/firestore/src/api/persistent_cache_index_manager.ts index 6568ebde1d..edd86aad32 100644 --- a/packages/firestore/src/api/persistent_cache_index_manager.ts +++ b/packages/firestore/src/api/persistent_cache_index_manager.ts @@ -42,7 +42,7 @@ export class PersistentCacheIndexManager { * Returns the PersistentCache Index Manager used by the given `Firestore` * object. * - * @return The `PersistentCacheIndexManager` instance, or `null` if local + * @returns The `PersistentCacheIndexManager` instance, or `null` if local * persistent storage is not in use. */ export function getPersistentCacheIndexManager( diff --git a/packages/firestore/src/api/pipeline_impl.ts b/packages/firestore/src/api/pipeline_impl.ts index e5d650847d..ba4544f407 100644 --- a/packages/firestore/src/api/pipeline_impl.ts +++ b/packages/firestore/src/api/pipeline_impl.ts @@ -40,7 +40,7 @@ import { ExpUserDataWriter } from './user_data_writer'; declare module './database' { /** * @beta - * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link Pipeline}. + * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link @firebase/firestore/pipelines#Pipeline}. * * @example * ``` @@ -59,23 +59,22 @@ declare module './database' { * The returned Promise can be used to track the progress of the pipeline execution * and retrieve the results (or handle any errors) asynchronously. * - * The pipeline results are returned as a {@link PipelineSnapshot} that contains - * a list of {@link PipelineResult} objects. Each {@link PipelineResult} typically + * The pipeline results are returned as a {@link @firebase/firestore/pipelines#PipelineSnapshot} that contains + * a list of {@link @firebase/firestore/pipelines#PipelineResult} objects. Each {@link @firebase/firestore/pipelines#PipelineResult} typically * represents a single key/value map that has passed through all the * stages of the pipeline, however this might differ depending on the stages involved in the * pipeline. For example: * *

    - *
  • If there are no stages or only transformation stages, each {@link PipelineResult} + *
  • If there are no stages or only transformation stages, each {@link @firebase/firestore/pipelines#PipelineResult} * represents a single document.
  • - *
  • If there is an aggregation, only a single {@link PipelineResult} is returned, + *
  • If there is an aggregation, only a single {@link @firebase/firestore/pipelines#PipelineResult} is returned, * representing the aggregated results over the entire dataset .
  • - *
  • If there is an aggregation stage with grouping, each {@link PipelineResult} represents a + *
  • If there is an aggregation stage with grouping, each {@link @firebase/firestore/pipelines#PipelineResult} represents a * distinct group and its associated aggregated values.
  • *
* - *

Example: - * + * @example * ```typescript * const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") * .where(gt(field("rating"), 4.5)) @@ -84,8 +83,8 @@ declare module './database' { * const results: PipelineResults = snapshot.results; * ``` * - * @param pipeline The pipeline to execute. - * @return A Promise representing the asynchronous pipeline execution. + * @param pipeline - The pipeline to execute. + * @returns A Promise representing the asynchronous pipeline execution. */ export function execute(pipeline: LitePipeline): Promise; /** @@ -95,23 +94,22 @@ export function execute(pipeline: LitePipeline): Promise; * The returned Promise can be used to track the progress of the pipeline execution * and retrieve the results (or handle any errors) asynchronously. * - * The pipeline results are returned as a {@link PipelineSnapshot} that contains - * a list of {@link PipelineResult} objects. Each {@link PipelineResult} typically + * The pipeline results are returned as a {@link @firebase/firestore/pipelines#PipelineSnapshot} that contains + * a list of {@link @firebase/firestore/pipelines#PipelineResult} objects. Each {@link @firebase/firestore/pipelines#PipelineResult} typically * represents a single key/value map that has passed through all the * stages of the pipeline, however this might differ depending on the stages involved in the * pipeline. For example: * *

    - *
  • If there are no stages or only transformation stages, each {@link PipelineResult} + *
  • If there are no stages or only transformation stages, each {@link @firebase/firestore/pipelines#PipelineResult} * represents a single document.
  • - *
  • If there is an aggregation, only a single {@link PipelineResult} is returned, + *
  • If there is an aggregation, only a single {@link @firebase/firestore/pipelines#PipelineResult} is returned, * representing the aggregated results over the entire dataset .
  • - *
  • If there is an aggregation stage with grouping, each {@link PipelineResult} represents a + *
  • If there is an aggregation stage with grouping, each {@link @firebase/firestore/pipelines#PipelineResult} represents a * distinct group and its associated aggregated values.
  • *
* - *

Example: - * + * @example * ```typescript * const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") * .where(gt(field("rating"), 4.5)) @@ -120,8 +118,8 @@ export function execute(pipeline: LitePipeline): Promise; * const results: PipelineResults = snapshot.results; * ``` * - * @param options Specifies the pipeline to execute and other options for execute. - * @return A Promise representing the asynchronous pipeline execution. + * @param options - Specifies the pipeline to execute and other options for execute. + * @returns A Promise representing the asynchronous pipeline execution. */ export function execute( options: PipelineExecuteOptions @@ -191,7 +189,7 @@ export function execute( /** * @beta - * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link Pipeline}. + * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link @firebase/firestore/pipelines#Pipeline}. * * @example * ``` diff --git a/packages/firestore/src/core/database_info.ts b/packages/firestore/src/core/database_info.ts index ec75ba2486..ae3082493c 100644 --- a/packages/firestore/src/core/database_info.ts +++ b/packages/firestore/src/core/database_info.ts @@ -35,8 +35,8 @@ export class DatabaseInfo { * when using WebChannel as the network transport. * @param autoDetectLongPolling - Whether to use the detectBufferingProxy * option when using WebChannel as the network transport. - * @param longPollingOptions Options that configure long-polling. - * @param useFetchStreams Whether to use the Fetch API instead of + * @param longPollingOptions - Options that configure long-polling. + * @param useFetchStreams - Whether to use the Fetch API instead of * XMLHTTPRequest */ constructor( diff --git a/packages/firestore/src/lite-api/aggregate.ts b/packages/firestore/src/lite-api/aggregate.ts index 0ffc42bebe..c1cc173f61 100644 --- a/packages/firestore/src/lite-api/aggregate.ts +++ b/packages/firestore/src/lite-api/aggregate.ts @@ -44,7 +44,7 @@ import { fieldPathFromArgument } from './user_data_reader'; * count the documents in cases where the result set is prohibitively large to * download entirely (thousands of documents). * - * @param query The query whose result set size is calculated. + * @param query - The query whose result set size is calculated. * @returns A Promise that will be resolved with the count; the count can be * retrieved from `snapshot.data().count`, where `snapshot` is the * `AggregateQuerySnapshot` to which the returned Promise resolves. @@ -74,8 +74,8 @@ export function getCount( * function can perform aggregations of the documents in cases where the result * set is prohibitively large to download entirely (thousands of documents). * - * @param query The query whose result set is aggregated over. - * @param aggregateSpec An `AggregateSpec` object that specifies the aggregates + * @param query - The query whose result set is aggregated over. + * @param aggregateSpec - An `AggregateSpec` object that specifies the aggregates * to perform over the result set. The AggregateSpec specifies aliases for each * aggregate, which can be used to retrieve the aggregate result. * @example @@ -143,7 +143,7 @@ function convertToAggregateQuerySnapshot< /** * Create an AggregateField object that can be used to compute the sum of * a specified field over a range of documents in the result set of a query. - * @param field Specifies the field to sum across the result set. + * @param field - Specifies the field to sum across the result set. */ export function sum(field: string | FieldPath): AggregateField { return new AggregateField('sum', fieldPathFromArgument('sum', field)); @@ -152,7 +152,7 @@ export function sum(field: string | FieldPath): AggregateField { /** * Create an AggregateField object that can be used to compute the average of * a specified field over a range of documents in the result set of a query. - * @param field Specifies the field to average across the result set. + * @param field - Specifies the field to average across the result set. */ export function average( field: string | FieldPath @@ -171,8 +171,8 @@ export function count(): AggregateField { /** * Compares two 'AggregateField` instances for equality. * - * @param left Compare this AggregateField to the `right`. - * @param right Compare this AggregateField to the `left`. + * @param left - Compare this AggregateField to the `right`. + * @param right - Compare this AggregateField to the `left`. */ export function aggregateFieldEqual( left: AggregateField, diff --git a/packages/firestore/src/lite-api/aggregate_types.ts b/packages/firestore/src/lite-api/aggregate_types.ts index 292a2edd4f..ae090f8f9a 100644 --- a/packages/firestore/src/lite-api/aggregate_types.ts +++ b/packages/firestore/src/lite-api/aggregate_types.ts @@ -43,8 +43,8 @@ export class AggregateField { /** * Create a new AggregateField - * @param aggregateType Specifies the type of aggregation operation to perform. - * @param _internalFieldPath Optionally specifies the field that is aggregated. + * @param aggregateType - Specifies the type of aggregation operation to perform. + * @param _internalFieldPath - Optionally specifies the field that is aggregated. * @internal */ constructor( diff --git a/packages/firestore/src/lite-api/bytes.ts b/packages/firestore/src/lite-api/bytes.ts index 225ad7918a..76ba3181ae 100644 --- a/packages/firestore/src/lite-api/bytes.ts +++ b/packages/firestore/src/lite-api/bytes.ts @@ -116,7 +116,7 @@ export class Bytes { /** * Builds a `Bytes` instance from a JSON object created by {@link Bytes.toJSON}. * - * @param json a JSON object represention of a `Bytes` instance + * @param json - a JSON object represention of a `Bytes` instance * @returns an instance of {@link Bytes} if the JSON object could be parsed. Throws a * {@link FirestoreError} if an error occurs. */ diff --git a/packages/firestore/src/lite-api/expressions.ts b/packages/firestore/src/lite-api/expressions.ts index 7b236ea5c6..0bae99b45f 100644 --- a/packages/firestore/src/lite-api/expressions.ts +++ b/packages/firestore/src/lite-api/expressions.ts @@ -56,7 +56,7 @@ export type ExpressionType = | 'AliasedExpression'; /** - * Converts a value to an Expr, Returning either a Constant, MapFunction, + * Converts a value to an Expression, Returning either a Constant, MapFunction, * ArrayFunction, or the input itself (if it's already an expression). * * @private @@ -79,7 +79,7 @@ function valueToDefaultExpr(value: unknown): Expression { } /** - * Converts a value to an Expr, Returning either a Constant, MapFunction, + * Converts a value to an Expression, Returning either a Constant, MapFunction, * ArrayFunction, or the input itself (if it's already an expression). * * @private @@ -99,7 +99,7 @@ function vectorToExpr(value: VectorValue | number[] | Expression): Expression { } /** - * Converts a value to an Expr, Returning either a Constant, MapFunction, + * Converts a value to an Expression, Returning either a Constant, MapFunction, * ArrayFunction, or the input itself (if it's already an expression). * If the input is a string, it is assumed to be a field name, and a * field(value) is returned. @@ -121,7 +121,7 @@ function fieldOrExpression(value: unknown): Expression { * @beta * * Represents an expression that can be evaluated to a value within the execution of a {@link - * Pipeline}. + * @firebase/firestore/pipelines#Pipeline}. * * Expressions are the building blocks for creating complex queries and transformations in * Firestore pipelines. They can represent: @@ -130,7 +130,7 @@ function fieldOrExpression(value: unknown): Expression { * - **Literals:** Represent constant values (strings, numbers, booleans). * - **Function calls:** Apply functions to one or more expressions. * - * The `Expr` class provides a fluent API for building expressions. You can chain together + * The `Expression` class provides a fluent API for building expressions. You can chain together * method calls to create complex expressions. */ export abstract class Expression implements ProtoValueSerializable, UserData { @@ -154,14 +154,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { /** * Creates an expression that adds this expression to another expression. * + * @example * ```typescript * // Add the value of the 'quantity' field and the 'reserve' field. * field("quantity").add(field("reserve")); * ``` * - * @param second The expression or literal to add to this expression. - * @param others Optional additional expressions or literals to add to this expression. - * @return A new `Expr` representing the addition operation. + * @param second - The expression or literal to add to this expression. + * @param others - Optional additional expressions or literals to add to this expression. + * @returns A new `Expression` representing the addition operation. */ add(second: Expression | unknown): FunctionExpression { return new FunctionExpression( @@ -175,7 +176,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Wraps the expression in a [BooleanExpression]. * - * @return A [BooleanExpression] representing the same expression. + * @returns A [BooleanExpression] representing the same expression. */ asBoolean(): BooleanExpression { if (this instanceof BooleanExpression) { @@ -198,13 +199,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that subtracts another expression from this expression. * + * @example * ```typescript * // Subtract the 'discount' field from the 'price' field * field("price").subtract(field("discount")); * ``` * - * @param subtrahend The expression to subtract from this expression. - * @return A new `Expr` representing the subtraction operation. + * @param subtrahend - The expression to subtract from this expression. + * @returns A new `Expression` representing the subtraction operation. */ subtract(subtrahend: Expression): FunctionExpression; @@ -212,13 +214,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that subtracts a constant value from this expression. * + * @example * ```typescript * // Subtract 20 from the value of the 'total' field * field("total").subtract(20); * ``` * - * @param subtrahend The constant value to subtract. - * @return A new `Expr` representing the subtraction operation. + * @param subtrahend - The constant value to subtract. + * @returns A new `Expression` representing the subtraction operation. */ subtract(subtrahend: number): FunctionExpression; subtract(subtrahend: number | Expression): FunctionExpression { @@ -233,14 +236,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that multiplies this expression by another expression. * + * @example * ```typescript * // Multiply the 'quantity' field by the 'price' field * field("quantity").multiply(field("price")); * ``` * - * @param second The second expression or literal to multiply by. - * @param others Optional additional expressions or literals to multiply by. - * @return A new `Expr` representing the multiplication operation. + * @param second - The second expression or literal to multiply by. + * @param others - Optional additional expressions or literals to multiply by. + * @returns A new `Expression` representing the multiplication operation. */ multiply(second: Expression | number): FunctionExpression { return new FunctionExpression( @@ -254,13 +258,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that divides this expression by another expression. * + * @example * ```typescript * // Divide the 'total' field by the 'count' field * field("total").divide(field("count")); * ``` * - * @param divisor The expression to divide by. - * @return A new `Expr` representing the division operation. + * @param divisor - The expression to divide by. + * @returns A new `Expression` representing the division operation. */ divide(divisor: Expression): FunctionExpression; @@ -268,13 +273,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that divides this expression by a constant value. * + * @example * ```typescript * // Divide the 'value' field by 10 * field("value").divide(10); * ``` * - * @param divisor The constant value to divide by. - * @return A new `Expr` representing the division operation. + * @param divisor - The constant value to divide by. + * @returns A new `Expression` representing the division operation. */ divide(divisor: number): FunctionExpression; divide(divisor: number | Expression): FunctionExpression { @@ -289,13 +295,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that calculates the modulo (remainder) of dividing this expression by another expression. * + * @example * ```typescript * // Calculate the remainder of dividing the 'value' field by the 'divisor' field * field("value").mod(field("divisor")); * ``` * - * @param expression The expression to divide by. - * @return A new `Expr` representing the modulo operation. + * @param expression - The expression to divide by. + * @returns A new `Expression` representing the modulo operation. */ mod(expression: Expression): FunctionExpression; @@ -303,13 +310,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that calculates the modulo (remainder) of dividing this expression by a constant value. * + * @example * ```typescript * // Calculate the remainder of dividing the 'value' field by 10 * field("value").mod(10); * ``` * - * @param value The constant value to divide by. - * @return A new `Expr` representing the modulo operation. + * @param value - The constant value to divide by. + * @returns A new `Expression` representing the modulo operation. */ mod(value: number): FunctionExpression; mod(other: number | Expression): FunctionExpression { @@ -324,13 +332,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is equal to another expression. * + * @example * ```typescript * // Check if the 'age' field is equal to 21 * field("age").equal(21); * ``` * - * @param expression The expression to compare for equality. - * @return A new `Expr` representing the equality comparison. + * @param expression - The expression to compare for equality. + * @returns A new `Expression` representing the equality comparison. */ equal(expression: Expression): BooleanExpression; @@ -338,13 +347,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is equal to a constant value. * + * @example * ```typescript * // Check if the 'city' field is equal to "London" * field("city").equal("London"); * ``` * - * @param value The constant value to compare for equality. - * @return A new `Expr` representing the equality comparison. + * @param value - The constant value to compare for equality. + * @returns A new `Expression` representing the equality comparison. */ equal(value: unknown): BooleanExpression; equal(other: unknown): BooleanExpression { @@ -359,13 +369,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is not equal to another expression. * + * @example * ```typescript * // Check if the 'status' field is not equal to "completed" * field("status").notEqual("completed"); * ``` * - * @param expression The expression to compare for inequality. - * @return A new `Expr` representing the inequality comparison. + * @param expression - The expression to compare for inequality. + * @returns A new `Expression` representing the inequality comparison. */ notEqual(expression: Expression): BooleanExpression; @@ -373,13 +384,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is not equal to a constant value. * + * @example * ```typescript * // Check if the 'country' field is not equal to "USA" * field("country").notEqual("USA"); * ``` * - * @param value The constant value to compare for inequality. - * @return A new `Expr` representing the inequality comparison. + * @param value - The constant value to compare for inequality. + * @returns A new `Expression` representing the inequality comparison. */ notEqual(value: unknown): BooleanExpression; notEqual(other: unknown): BooleanExpression { @@ -394,13 +406,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is less than another expression. * + * @example * ```typescript * // Check if the 'age' field is less than 'limit' * field("age").lessThan(field('limit')); * ``` * - * @param experession The expression to compare for less than. - * @return A new `Expr` representing the less than comparison. + * @param experession - The expression to compare for less than. + * @returns A new `Expression` representing the less than comparison. */ lessThan(experession: Expression): BooleanExpression; @@ -408,13 +421,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is less than a constant value. * + * @example * ```typescript * // Check if the 'price' field is less than 50 * field("price").lessThan(50); * ``` * - * @param value The constant value to compare for less than. - * @return A new `Expr` representing the less than comparison. + * @param value - The constant value to compare for less than. + * @returns A new `Expression` representing the less than comparison. */ lessThan(value: unknown): BooleanExpression; lessThan(other: unknown): BooleanExpression { @@ -430,13 +444,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if this expression is less than or equal to another * expression. * + * @example * ```typescript * // Check if the 'quantity' field is less than or equal to 20 * field("quantity").lessThan(constant(20)); * ``` * - * @param expression The expression to compare for less than or equal to. - * @return A new `Expr` representing the less than or equal to comparison. + * @param expression - The expression to compare for less than or equal to. + * @returns A new `Expression` representing the less than or equal to comparison. */ lessThanOrEqual(expression: Expression): BooleanExpression; @@ -444,13 +459,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is less than or equal to a constant value. * + * @example * ```typescript * // Check if the 'score' field is less than or equal to 70 * field("score").lessThan(70); * ``` * - * @param value The constant value to compare for less than or equal to. - * @return A new `Expr` representing the less than or equal to comparison. + * @param value - The constant value to compare for less than or equal to. + * @returns A new `Expression` representing the less than or equal to comparison. */ lessThanOrEqual(value: unknown): BooleanExpression; lessThanOrEqual(other: unknown): BooleanExpression { @@ -465,13 +481,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is greater than another expression. * + * @example * ```typescript * // Check if the 'age' field is greater than the 'limit' field * field("age").greaterThan(field("limit")); * ``` * - * @param expression The expression to compare for greater than. - * @return A new `Expr` representing the greater than comparison. + * @param expression - The expression to compare for greater than. + * @returns A new `Expression` representing the greater than comparison. */ greaterThan(expression: Expression): BooleanExpression; @@ -479,13 +496,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is greater than a constant value. * + * @example * ```typescript * // Check if the 'price' field is greater than 100 * field("price").greaterThan(100); * ``` * - * @param value The constant value to compare for greater than. - * @return A new `Expr` representing the greater than comparison. + * @param value - The constant value to compare for greater than. + * @returns A new `Expression` representing the greater than comparison. */ greaterThan(value: unknown): BooleanExpression; greaterThan(other: unknown): BooleanExpression { @@ -501,13 +519,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if this expression is greater than or equal to another * expression. * + * @example * ```typescript * // Check if the 'quantity' field is greater than or equal to field 'requirement' plus 1 * field("quantity").greaterThanOrEqual(field('requirement').add(1)); * ``` * - * @param expression The expression to compare for greater than or equal to. - * @return A new `Expr` representing the greater than or equal to comparison. + * @param expression - The expression to compare for greater than or equal to. + * @returns A new `Expression` representing the greater than or equal to comparison. */ greaterThanOrEqual(expression: Expression): BooleanExpression; @@ -516,13 +535,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if this expression is greater than or equal to a constant * value. * + * @example * ```typescript * // Check if the 'score' field is greater than or equal to 80 * field("score").greaterThanOrEqual(80); * ``` * - * @param value The constant value to compare for greater than or equal to. - * @return A new `Expr` representing the greater than or equal to comparison. + * @param value - The constant value to compare for greater than or equal to. + * @returns A new `Expression` representing the greater than or equal to comparison. */ greaterThanOrEqual(value: unknown): BooleanExpression; greaterThanOrEqual(other: unknown): BooleanExpression { @@ -537,13 +557,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that concatenates an array expression with one or more other arrays. * + * @example * ```typescript * // Combine the 'items' array with another array field. * field("items").arrayConcat(field("otherItems")); * ``` - * @param secondArray Second array expression or array literal to concatenate. - * @param otherArrays Optional additional array expressions or array literals to concatenate. - * @return A new `Expr` representing the concatenated array. + * @param secondArray - Second array expression or array literal to concatenate. + * @param otherArrays - Optional additional array expressions or array literals to concatenate. + * @returns A new `Expression` representing the concatenated array. */ arrayConcat( secondArray: Expression | unknown[], @@ -562,13 +583,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if an array contains a specific element. * + * @example * ```typescript * // Check if the 'sizes' array contains the value from the 'selectedSize' field * field("sizes").arrayContains(field("selectedSize")); * ``` * - * @param expression The element to search for in the array. - * @return A new `Expr` representing the 'array_contains' comparison. + * @param expression - The element to search for in the array. + * @returns A new `Expression` representing the 'array_contains' comparison. */ arrayContains(expression: Expression): BooleanExpression; @@ -576,13 +598,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if an array contains a specific value. * + * @example * ```typescript * // Check if the 'colors' array contains "red" * field("colors").arrayContains("red"); * ``` * - * @param value The element to search for in the array. - * @return A new `Expr` representing the 'array_contains' comparison. + * @param value - The element to search for in the array. + * @returns A new `Expression` representing the 'array_contains' comparison. */ arrayContains(value: unknown): BooleanExpression; arrayContains(element: unknown): BooleanExpression { @@ -597,13 +620,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if an array contains all the specified elements. * + * @example * ```typescript * // Check if the 'tags' array contains both the value in field "tag1" and the literal value "tag2" * field("tags").arrayContainsAll([field("tag1"), "tag2"]); * ``` * - * @param values The elements to check for in the array. - * @return A new `Expr` representing the 'array_contains_all' comparison. + * @param values - The elements to check for in the array. + * @returns A new `Expression` representing the 'array_contains_all' comparison. */ arrayContainsAll(values: Array): BooleanExpression; @@ -611,13 +635,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if an array contains all the specified elements. * + * @example * ```typescript * // Check if the 'tags' array contains both of the values from field "tag1" and the literal value "tag2" * field("tags").arrayContainsAll(array([field("tag1"), "tag2"])); * ``` * - * @param arrayExpression The elements to check for in the array. - * @return A new `Expr` representing the 'array_contains_all' comparison. + * @param arrayExpression - The elements to check for in the array. + * @returns A new `Expression` representing the 'array_contains_all' comparison. */ arrayContainsAll(arrayExpression: Expression): BooleanExpression; arrayContainsAll(values: unknown[] | Expression): BooleanExpression { @@ -635,13 +660,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if an array contains any of the specified elements. * + * @example * ```typescript * // Check if the 'categories' array contains either values from field "cate1" or "cate2" * field("categories").arrayContainsAny([field("cate1"), field("cate2")]); * ``` * - * @param values The elements to check for in the array. - * @return A new `Expr` representing the 'array_contains_any' comparison. + * @param values - The elements to check for in the array. + * @returns A new `Expression` representing the 'array_contains_any' comparison. */ arrayContainsAny(values: Array): BooleanExpression; @@ -649,14 +675,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if an array contains any of the specified elements. * + * @example * ```typescript * // Check if the 'groups' array contains either the value from the 'userGroup' field * // or the value "guest" * field("groups").arrayContainsAny(array([field("userGroup"), "guest"])); * ``` * - * @param arrayExpression The elements to check for in the array. - * @return A new `Expr` representing the 'array_contains_any' comparison. + * @param arrayExpression - The elements to check for in the array. + * @returns A new `Expression` representing the 'array_contains_any' comparison. */ arrayContainsAny(arrayExpression: Expression): BooleanExpression; arrayContainsAny( @@ -676,12 +703,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that reverses an array. * + * @example * ```typescript * // Reverse the value of the 'myArray' field. * field("myArray").arrayReverse(); * ``` * - * @return A new {@code Expr} representing the reversed array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed array. */ arrayReverse(): FunctionExpression { return new FunctionExpression('array_reverse', [this]); @@ -691,12 +719,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that calculates the length of an array. * + * @example * ```typescript * // Get the number of items in the 'cart' array * field("cart").arrayLength(); * ``` * - * @return A new `Expr` representing the length of the array. + * @returns A new `Expression` representing the length of the array. */ arrayLength(): FunctionExpression { return new FunctionExpression('array_length', [this], 'arrayLength'); @@ -707,13 +736,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if this expression is equal to any of the provided values or * expressions. * + * @example * ```typescript * // Check if the 'category' field is either "Electronics" or value of field 'primaryType' * field("category").equalAny("Electronics", field("primaryType")); * ``` * - * @param values The values or expressions to check against. - * @return A new `Expr` representing the 'IN' comparison. + * @param values - The values or expressions to check against. + * @returns A new `Expression` representing the 'IN' comparison. */ equalAny(values: Array): BooleanExpression; @@ -722,13 +752,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if this expression is equal to any of the provided values or * expressions. * + * @example * ```typescript * // Check if the 'category' field is either "Electronics" or value of field 'primaryType' * field("category").equalAny(array(["Electronics", field("primaryType")])); * ``` * - * @param arrayExpression An expression that evaluates to an array of values to check against. - * @return A new `Expr` representing the 'IN' comparison. + * @param arrayExpression - An expression that evaluates to an array of values to check against. + * @returns A new `Expression` representing the 'IN' comparison. */ equalAny(arrayExpression: Expression): BooleanExpression; equalAny(others: unknown[] | Expression): BooleanExpression { @@ -747,13 +778,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if this expression is not equal to any of the provided values or * expressions. * + * @example * ```typescript * // Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' * field("status").notEqualAny(["pending", field("rejectedStatus")]); * ``` * - * @param values The values or expressions to check against. - * @return A new `Expr` representing the 'notEqualAny' comparison. + * @param values - The values or expressions to check against. + * @returns A new `Expression` representing the 'notEqualAny' comparison. */ notEqualAny(values: Array): BooleanExpression; @@ -761,13 +793,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if this expression is not equal to any of the values in the evaluated expression. * + * @example * ```typescript * // Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' * field("status").notEqualAny(field('rejectedStatuses')); * ``` * - * @param arrayExpression The values or expressions to check against. - * @return A new `Expr` representing the 'notEqualAny' comparison. + * @param arrayExpression - The values or expressions to check against. + * @returns A new `Expression` representing the 'notEqualAny' comparison. */ notEqualAny(arrayExpression: Expression): BooleanExpression; notEqualAny(others: unknown[] | Expression): BooleanExpression { @@ -785,12 +818,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if a field exists in the document. * + * @example * ```typescript * // Check if the document has a field named "phoneNumber" * field("phoneNumber").exists(); * ``` * - * @return A new `Expr` representing the 'exists' check. + * @returns A new `Expression` representing the 'exists' check. */ exists(): BooleanExpression { return new FunctionExpression('exists', [this], 'exists').asBoolean(); @@ -800,12 +834,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that calculates the character length of a string in UTF-8. * + * @example * ```typescript * // Get the character length of the 'name' field in its UTF-8 form. * field("name").charLength(); * ``` * - * @return A new `Expr` representing the length of the string. + * @returns A new `Expression` representing the length of the string. */ charLength(): FunctionExpression { return new FunctionExpression('char_length', [this], 'charLength'); @@ -815,13 +850,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that performs a case-sensitive string comparison. * + * @example * ```typescript * // Check if the 'title' field contains the word "guide" (case-sensitive) * field("title").like("%guide%"); * ``` * - * @param pattern The pattern to search for. You can use "%" as a wildcard character. - * @return A new `Expr` representing the 'like' comparison. + * @param pattern - The pattern to search for. You can use "%" as a wildcard character. + * @returns A new `Expression` representing the 'like' comparison. */ like(pattern: string): BooleanExpression; @@ -829,13 +865,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that performs a case-sensitive string comparison. * + * @example * ```typescript * // Check if the 'title' field contains the word "guide" (case-sensitive) * field("title").like("%guide%"); * ``` * - * @param pattern The pattern to search for. You can use "%" as a wildcard character. - * @return A new `Expr` representing the 'like' comparison. + * @param pattern - The pattern to search for. You can use "%" as a wildcard character. + * @returns A new `Expression` representing the 'like' comparison. */ like(pattern: Expression): BooleanExpression; like(stringOrExpr: string | Expression): BooleanExpression { @@ -851,13 +888,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if a string contains a specified regular expression as a * substring. * + * @example * ```typescript * // Check if the 'description' field contains "example" (case-insensitive) * field("description").regexContains("(?i)example"); * ``` * - * @param pattern The regular expression to use for the search. - * @return A new `Expr` representing the 'contains' comparison. + * @param pattern - The regular expression to use for the search. + * @returns A new `Expression` representing the 'contains' comparison. */ regexContains(pattern: string): BooleanExpression; @@ -866,13 +904,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if a string contains a specified regular expression as a * substring. * + * @example * ```typescript * // Check if the 'description' field contains the regular expression stored in field 'regex' * field("description").regexContains(field("regex")); * ``` * - * @param pattern The regular expression to use for the search. - * @return A new `Expr` representing the 'contains' comparison. + * @param pattern - The regular expression to use for the search. + * @returns A new `Expression` representing the 'contains' comparison. */ regexContains(pattern: Expression): BooleanExpression; regexContains(stringOrExpr: string | Expression): BooleanExpression { @@ -887,13 +926,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if a string matches a specified regular expression. * + * @example * ```typescript * // Check if the 'email' field matches a valid email pattern * field("email").regexMatch("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); * ``` * - * @param pattern The regular expression to use for the match. - * @return A new `Expr` representing the regular expression match. + * @param pattern - The regular expression to use for the match. + * @returns A new `Expression` representing the regular expression match. */ regexMatch(pattern: string): BooleanExpression; @@ -901,13 +941,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if a string matches a specified regular expression. * + * @example * ```typescript * // Check if the 'email' field matches a regular expression stored in field 'regex' * field("email").regexMatch(field("regex")); * ``` * - * @param pattern The regular expression to use for the match. - * @return A new `Expr` representing the regular expression match. + * @param pattern - The regular expression to use for the match. + * @returns A new `Expression` representing the regular expression match. */ regexMatch(pattern: Expression): BooleanExpression; regexMatch(stringOrExpr: string | Expression): BooleanExpression { @@ -922,13 +963,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if a string contains a specified substring. * + * @example * ```typescript * // Check if the 'description' field contains "example". * field("description").stringContains("example"); * ``` * - * @param substring The substring to search for. - * @return A new `Expr` representing the 'contains' comparison. + * @param substring - The substring to search for. + * @returns A new `Expression` representing the 'contains' comparison. */ stringContains(substring: string): BooleanExpression; @@ -936,13 +978,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if a string contains the string represented by another expression. * + * @example * ```typescript * // Check if the 'description' field contains the value of the 'keyword' field. * field("description").stringContains(field("keyword")); * ``` * - * @param expr The expression representing the substring to search for. - * @return A new `Expr` representing the 'contains' comparison. + * @param expr - The expression representing the substring to search for. + * @returns A new `Expression` representing the 'contains' comparison. */ stringContains(expr: Expression): BooleanExpression; stringContains(stringOrExpr: string | Expression): BooleanExpression { @@ -957,13 +1000,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if a string starts with a given prefix. * + * @example * ```typescript * // Check if the 'name' field starts with "Mr." * field("name").startsWith("Mr."); * ``` * - * @param prefix The prefix to check for. - * @return A new `Expr` representing the 'starts with' comparison. + * @param prefix - The prefix to check for. + * @returns A new `Expression` representing the 'starts with' comparison. */ startsWith(prefix: string): BooleanExpression; @@ -972,13 +1016,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if a string starts with a given prefix (represented as an * expression). * + * @example * ```typescript * // Check if the 'fullName' field starts with the value of the 'firstName' field * field("fullName").startsWith(field("firstName")); * ``` * - * @param prefix The prefix expression to check for. - * @return A new `Expr` representing the 'starts with' comparison. + * @param prefix - The prefix expression to check for. + * @returns A new `Expression` representing the 'starts with' comparison. */ startsWith(prefix: Expression): BooleanExpression; startsWith(stringOrExpr: string | Expression): BooleanExpression { @@ -993,13 +1038,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that checks if a string ends with a given postfix. * + * @example * ```typescript * // Check if the 'filename' field ends with ".txt" * field("filename").endsWith(".txt"); * ``` * - * @param suffix The postfix to check for. - * @return A new `Expr` representing the 'ends with' comparison. + * @param suffix - The postfix to check for. + * @returns A new `Expression` representing the 'ends with' comparison. */ endsWith(suffix: string): BooleanExpression; @@ -1008,13 +1054,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that checks if a string ends with a given postfix (represented as an * expression). * + * @example * ```typescript * // Check if the 'url' field ends with the value of the 'extension' field * field("url").endsWith(field("extension")); * ``` * - * @param suffix The postfix expression to check for. - * @return A new `Expr` representing the 'ends with' comparison. + * @param suffix - The postfix expression to check for. + * @returns A new `Expression` representing the 'ends with' comparison. */ endsWith(suffix: Expression): BooleanExpression; endsWith(stringOrExpr: string | Expression): BooleanExpression { @@ -1029,12 +1076,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that converts a string to lowercase. * + * @example * ```typescript * // Convert the 'name' field to lowercase * field("name").toLower(); * ``` * - * @return A new `Expr` representing the lowercase string. + * @returns A new `Expression` representing the lowercase string. */ toLower(): FunctionExpression { return new FunctionExpression('to_lower', [this], 'toLower'); @@ -1044,12 +1092,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that converts a string to uppercase. * + * @example * ```typescript * // Convert the 'title' field to uppercase * field("title").toUpper(); * ``` * - * @return A new `Expr` representing the uppercase string. + * @returns A new `Expression` representing the uppercase string. */ toUpper(): FunctionExpression { return new FunctionExpression('to_upper', [this], 'toUpper'); @@ -1059,6 +1108,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that removes leading and trailing characters from a string or byte array. * + * @example * ```typescript * // Trim whitespace from the 'userInput' field * field("userInput").trim(); @@ -1066,9 +1116,9 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * // Trim quotes from the 'userInput' field * field("userInput").trim('"'); * ``` - * @param valueToTrim Optional This parameter is treated as a set of characters or bytes that will be + * @param valueToTrim - Optional This parameter is treated as a set of characters or bytes that will be * trimmed from the input. If not specified, then whitespace will be trimmed. - * @return A new `Expr` representing the trimmed string or byte array. + * @returns A new `Expression` representing the trimmed string or byte array. */ trim(valueToTrim?: string | Expression | Bytes): FunctionExpression { const args: Expression[] = [this]; @@ -1082,14 +1132,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that concatenates string expressions together. * + * @example * ```typescript * // Combine the 'firstName', " ", and 'lastName' fields into a single string * field("firstName").stringConcat(constant(" "), field("lastName")); * ``` * - * @param secondString The additional expression or string literal to concatenate. - * @param otherStrings Optional additional expressions or string literals to concatenate. - * @return A new `Expr` representing the concatenated string. + * @param secondString - The additional expression or string literal to concatenate. + * @param otherStrings - Optional additional expressions or string literals to concatenate. + * @returns A new `Expression` representing the concatenated string. */ stringConcat( secondString: Expression | string, @@ -1108,14 +1159,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that concatenates expression results together. * + * @example * ```typescript * // Combine the 'firstName', ' ', and 'lastName' fields into a single value. * field("firstName").concat(constant(" "), field("lastName")); * ``` * - * @param second The additional expression or literal to concatenate. - * @param others Optional additional expressions or literals to concatenate. - * @return A new `Expr` representing the concatenated value. + * @param second - The additional expression or literal to concatenate. + * @param others - Optional additional expressions or literals to concatenate. + * @returns A new `Expression` representing the concatenated value. */ concat( second: Expression | unknown, @@ -1130,12 +1182,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that reverses this string expression. * + * @example * ```typescript * // Reverse the value of the 'myString' field. * field("myString").reverse(); * ``` * - * @return A new {@code Expr} representing the reversed string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string. */ reverse(): FunctionExpression { return new FunctionExpression('reverse', [this], 'reverse'); @@ -1145,12 +1198,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that calculates the length of this string expression in bytes. * + * @example * ```typescript * // Calculate the length of the 'myString' field in bytes. * field("myString").byteLength(); * ``` * - * @return A new {@code Expr} representing the length of the string in bytes. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string in bytes. */ byteLength(): FunctionExpression { return new FunctionExpression('byte_length', [this], 'byteLength'); @@ -1160,12 +1214,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes the ceiling of a numeric value. * + * @example * ```typescript * // Compute the ceiling of the 'price' field. * field("price").ceil(); * ``` * - * @return A new {@code Expr} representing the ceiling of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the ceiling of the numeric value. */ ceil(): FunctionExpression { return new FunctionExpression('ceil', [this]); @@ -1175,12 +1230,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes the floor of a numeric value. * + * @example * ```typescript * // Compute the floor of the 'price' field. * field("price").floor(); * ``` * - * @return A new {@code Expr} representing the floor of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the floor of the numeric value. */ floor(): FunctionExpression { return new FunctionExpression('floor', [this]); @@ -1190,12 +1246,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes the absolute value of a numeric value. * + * @example * ```typescript * // Compute the absolute value of the 'price' field. * field("price").abs(); * ``` * - * @return A new {@code Expr} representing the absolute value of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the absolute value of the numeric value. */ abs(): FunctionExpression { return new FunctionExpression('abs', [this]); @@ -1205,12 +1262,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes e to the power of this expression. * + * @example * ```typescript * // Compute e to the power of the 'value' field. * field("value").exp(); * ``` * - * @return A new {@code Expr} representing the exp of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the exp of the numeric value. */ exp(): FunctionExpression { return new FunctionExpression('exp', [this]); @@ -1220,13 +1278,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Accesses a value from a map (object) field using the provided key. * + * @example * ```typescript * // Get the 'city' value from the 'address' map field * field("address").mapGet("city"); * ``` * - * @param subfield The key to access in the map. - * @return A new `Expr` representing the value associated with the given key in the map. + * @param subfield - The key to access in the map. + * @returns A new `Expression` representing the value associated with the given key in the map. */ mapGet(subfield: string): FunctionExpression { return new FunctionExpression( @@ -1241,12 +1300,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an aggregation that counts the number of stage inputs with valid evaluations of the * expression or field. * + * @example * ```typescript * // Count the total number of products * field("productId").count().as("totalProducts"); * ``` * - * @return A new `AggregateFunction` representing the 'count' aggregation. + * @returns A new `AggregateFunction` representing the 'count' aggregation. */ count(): AggregateFunction { return AggregateFunction._create('count', [this], 'count'); @@ -1256,12 +1316,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an aggregation that calculates the sum of a numeric field across multiple stage inputs. * + * @example * ```typescript * // Calculate the total revenue from a set of orders * field("orderAmount").sum().as("totalRevenue"); * ``` * - * @return A new `AggregateFunction` representing the 'sum' aggregation. + * @returns A new `AggregateFunction` representing the 'sum' aggregation. */ sum(): AggregateFunction { return AggregateFunction._create('sum', [this], 'sum'); @@ -1272,12 +1333,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an aggregation that calculates the average (mean) of a numeric field across multiple * stage inputs. * + * @example * ```typescript * // Calculate the average age of users * field("age").average().as("averageAge"); * ``` * - * @return A new `AggregateFunction` representing the 'average' aggregation. + * @returns A new `AggregateFunction` representing the 'average' aggregation. */ average(): AggregateFunction { return AggregateFunction._create('average', [this], 'average'); @@ -1287,12 +1349,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an aggregation that finds the minimum value of a field across multiple stage inputs. * + * @example * ```typescript * // Find the lowest price of all products * field("price").minimum().as("lowestPrice"); * ``` * - * @return A new `AggregateFunction` representing the 'minimum' aggregation. + * @returns A new `AggregateFunction` representing the 'minimum' aggregation. */ minimum(): AggregateFunction { return AggregateFunction._create('minimum', [this], 'minimum'); @@ -1302,12 +1365,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an aggregation that finds the maximum value of a field across multiple stage inputs. * + * @example * ```typescript * // Find the highest score in a leaderboard * field("score").maximum().as("highestScore"); * ``` * - * @return A new `AggregateFunction` representing the 'maximum' aggregation. + * @returns A new `AggregateFunction` representing the 'maximum' aggregation. */ maximum(): AggregateFunction { return AggregateFunction._create('maximum', [this], 'maximum'); @@ -1317,12 +1381,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an aggregation that counts the number of distinct values of the expression or field. * + * @example * ```typescript * // Count the distinct number of products * field("productId").countDistinct().as("distinctProducts"); * ``` * - * @return A new `AggregateFunction` representing the 'count_distinct' aggregation. + * @returns A new `AggregateFunction` representing the 'count_distinct' aggregation. */ countDistinct(): AggregateFunction { return AggregateFunction._create('count_distinct', [this], 'countDistinct'); @@ -1332,14 +1397,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that returns the larger value between this expression and another expression, based on Firestore's value type ordering. * + * @example * ```typescript * // Returns the larger value between the 'timestamp' field and the current timestamp. * field("timestamp").logicalMaximum(Function.currentTimestamp()); * ``` * - * @param second The second expression or literal to compare with. - * @param others Optional additional expressions or literals to compare with. - * @return A new {@code Expr} representing the logical maximum operation. + * @param second - The second expression or literal to compare with. + * @param others - Optional additional expressions or literals to compare with. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical maximum operation. */ logicalMaximum( second: Expression | unknown, @@ -1357,14 +1423,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that returns the smaller value between this expression and another expression, based on Firestore's value type ordering. * + * @example * ```typescript * // Returns the smaller value between the 'timestamp' field and the current timestamp. * field("timestamp").logicalMinimum(Function.currentTimestamp()); * ``` * - * @param second The second expression or literal to compare with. - * @param others Optional additional expressions or literals to compare with. - * @return A new {@code Expr} representing the logical minimum operation. + * @param second - The second expression or literal to compare with. + * @param others - Optional additional expressions or literals to compare with. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical minimum operation. */ logicalMinimum( second: Expression | unknown, @@ -1382,12 +1449,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that calculates the length (number of dimensions) of this Firestore Vector expression. * + * @example * ```typescript * // Get the vector length (dimension) of the field 'embedding'. * field("embedding").vectorLength(); * ``` * - * @return A new {@code Expr} representing the length of the vector. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the vector. */ vectorLength(): FunctionExpression { return new FunctionExpression('vector_length', [this], 'vectorLength'); @@ -1397,26 +1465,28 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Calculates the cosine distance between two vectors. * + * @example * ```typescript * // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field * field("userVector").cosineDistance(field("itemVector")); * ``` * - * @param vectorExpression The other vector (represented as an Expr) to compare against. - * @return A new `Expr` representing the cosine distance between the two vectors. + * @param vectorExpression - The other vector (represented as an Expression) to compare against. + * @returns A new `Expression` representing the cosine distance between the two vectors. */ cosineDistance(vectorExpression: Expression): FunctionExpression; /** * @beta * Calculates the Cosine distance between two vectors. * + * @example * ```typescript * // Calculate the Cosine distance between the 'location' field and a target location * field("location").cosineDistance(new VectorValue([37.7749, -122.4194])); * ``` * - * @param vector The other vector (as a VectorValue) to compare against. - * @return A new `Expr` representing the Cosine* distance between the two vectors. + * @param vector - The other vector (as a VectorValue) to compare against. + * @returns A new `Expression` representing the Cosine* distance between the two vectors. */ cosineDistance(vector: VectorValue | number[]): FunctionExpression; cosineDistance( @@ -1433,13 +1503,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Calculates the dot product between two vectors. * + * @example * ```typescript * // Calculate the dot product between a feature vector and a target vector * field("features").dotProduct([0.5, 0.8, 0.2]); * ``` * - * @param vectorExpression The other vector (as an array of numbers) to calculate with. - * @return A new `Expr` representing the dot product between the two vectors. + * @param vectorExpression - The other vector (as an array of numbers) to calculate with. + * @returns A new `Expression` representing the dot product between the two vectors. */ dotProduct(vectorExpression: Expression): FunctionExpression; @@ -1447,13 +1518,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Calculates the dot product between two vectors. * + * @example * ```typescript * // Calculate the dot product between a feature vector and a target vector * field("features").dotProduct(new VectorValue([0.5, 0.8, 0.2])); * ``` * - * @param vector The other vector (as an array of numbers) to calculate with. - * @return A new `Expr` representing the dot product between the two vectors. + * @param vector - The other vector (as an array of numbers) to calculate with. + * @returns A new `Expression` representing the dot product between the two vectors. */ dotProduct(vector: VectorValue | number[]): FunctionExpression; dotProduct(other: Expression | VectorValue | number[]): FunctionExpression { @@ -1468,13 +1540,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Calculates the Euclidean distance between two vectors. * + * @example * ```typescript * // Calculate the Euclidean distance between the 'location' field and a target location * field("location").euclideanDistance([37.7749, -122.4194]); * ``` * - * @param vectorExpression The other vector (as an array of numbers) to calculate with. - * @return A new `Expr` representing the Euclidean distance between the two vectors. + * @param vectorExpression - The other vector (as an array of numbers) to calculate with. + * @returns A new `Expression` representing the Euclidean distance between the two vectors. */ euclideanDistance(vectorExpression: Expression): FunctionExpression; @@ -1482,13 +1555,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Calculates the Euclidean distance between two vectors. * + * @example * ```typescript * // Calculate the Euclidean distance between the 'location' field and a target location * field("location").euclideanDistance(new VectorValue([37.7749, -122.4194])); * ``` * - * @param vector The other vector (as a VectorValue) to compare against. - * @return A new `Expr` representing the Euclidean distance between the two vectors. + * @param vector - The other vector (as a VectorValue) to compare against. + * @returns A new `Expression` representing the Euclidean distance between the two vectors. */ euclideanDistance(vector: VectorValue | number[]): FunctionExpression; euclideanDistance( @@ -1506,12 +1580,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that interprets this expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'microseconds' field as microseconds since epoch. * field("microseconds").unixMicrosToTimestamp(); * ``` * - * @return A new {@code Expr} representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ unixMicrosToTimestamp(): FunctionExpression { return new FunctionExpression( @@ -1525,12 +1600,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that converts this timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to microseconds since epoch. * field("timestamp").timestampToUnixMicros(); * ``` * - * @return A new {@code Expr} representing the number of microseconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of microseconds since epoch. */ timestampToUnixMicros(): FunctionExpression { return new FunctionExpression( @@ -1545,12 +1621,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that interprets this expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'milliseconds' field as milliseconds since epoch. * field("milliseconds").unixMillisToTimestamp(); * ``` * - * @return A new {@code Expr} representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ unixMillisToTimestamp(): FunctionExpression { return new FunctionExpression( @@ -1564,12 +1641,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that converts this timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to milliseconds since epoch. * field("timestamp").timestampToUnixMillis(); * ``` * - * @return A new {@code Expr} representing the number of milliseconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of milliseconds since epoch. */ timestampToUnixMillis(): FunctionExpression { return new FunctionExpression( @@ -1584,12 +1662,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that interprets this expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'seconds' field as seconds since epoch. * field("seconds").unixSecondsToTimestamp(); * ``` * - * @return A new {@code Expr} representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ unixSecondsToTimestamp(): FunctionExpression { return new FunctionExpression( @@ -1603,12 +1682,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that converts this timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to seconds since epoch. * field("timestamp").timestampToUnixSeconds(); * ``` * - * @return A new {@code Expr} representing the number of seconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of seconds since epoch. */ timestampToUnixSeconds(): FunctionExpression { return new FunctionExpression( @@ -1622,14 +1702,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that adds a specified amount of time to this timestamp expression. * + * @example * ```typescript * // Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. * field("timestamp").timestampAdd(field("unit"), field("amount")); * ``` * - * @param unit The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. - * @param amount The expression evaluates to amount of the unit. - * @return A new {@code Expr} representing the resulting timestamp. + * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. + * @param amount - The expression evaluates to amount of the unit. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ timestampAdd(unit: Expression, amount: Expression): FunctionExpression; @@ -1637,14 +1718,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that adds a specified amount of time to this timestamp expression. * + * @example * ```typescript * // Add 1 day to the 'timestamp' field. * field("timestamp").timestampAdd("day", 1); * ``` * - * @param unit The unit of time to add (e.g., "day", "hour"). - * @param amount The amount of time to add. - * @return A new {@code Expr} representing the resulting timestamp. + * @param unit - The unit of time to add (e.g., "day", "hour"). + * @param amount - The amount of time to add. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ timestampAdd( unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day', @@ -1672,14 +1754,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that subtracts a specified amount of time from this timestamp expression. * + * @example * ```typescript * // Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. * field("timestamp").timestampSubtract(field("unit"), field("amount")); * ``` * - * @param unit The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. - * @param amount The expression evaluates to amount of the unit. - * @return A new {@code Expr} representing the resulting timestamp. + * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. + * @param amount - The expression evaluates to amount of the unit. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ timestampSubtract(unit: Expression, amount: Expression): FunctionExpression; @@ -1687,14 +1770,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that subtracts a specified amount of time from this timestamp expression. * + * @example * ```typescript * // Subtract 1 day from the 'timestamp' field. * field("timestamp").timestampSubtract("day", 1); * ``` * - * @param unit The unit of time to subtract (e.g., "day", "hour"). - * @param amount The amount of time to subtract. - * @return A new {@code Expr} representing the resulting timestamp. + * @param unit - The unit of time to subtract (e.g., "day", "hour"). + * @param amount - The amount of time to subtract. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ timestampSubtract( unit: 'microsecond' | 'millisecond' | 'second' | 'minute' | 'hour' | 'day', @@ -1723,12 +1807,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * * Creates an expression that returns the document ID from a path. * + * @example * ```typescript * // Get the document ID from a path. * field("__path__").documentId(); * ``` * - * @return A new {@code Expr} representing the documentId operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the documentId operation. */ documentId(): FunctionExpression { return new FunctionExpression('document_id', [this], 'documentId'); @@ -1739,8 +1824,8 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * * Creates an expression that returns a substring of the results of this expression. * - * @param position Index of the first character of the substring. - * @param length Length of the substring. If not provided, the substring will + * @param position - Index of the first character of the substring. + * @param length - Length of the substring. If not provided, the substring will * end at the end of the input. */ substring(position: number, length?: number): FunctionExpression; @@ -1750,8 +1835,8 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * * Creates an expression that returns a substring of the results of this expression. * - * @param position An expression returning the index of the first character of the substring. - * @param length An expression returning the length of the substring. If not provided the + * @param position - An expression returning the index of the first character of the substring. + * @param length - An expression returning the length of the substring. If not provided the * substring will end at the end of the input. */ substring(position: Expression, length?: Expression): FunctionExpression; @@ -1781,13 +1866,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * and returns the element. If the offset exceeds the array length, an error is * returned. A negative offset, starts from the end. * + * @example * ```typescript * // Return the value in the 'tags' field array at index `1`. * field('tags').arrayGet(1); * ``` * - * @param offset The index of the element to return. - * @return A new Expr representing the 'arrayGet' operation. + * @param offset - The index of the element to return. + * @returns A new `Expression` representing the 'arrayGet' operation. */ arrayGet(offset: number): FunctionExpression; @@ -1797,14 +1883,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * and returns the element. If the offset exceeds the array length, an error is * returned. A negative offset, starts from the end. * + * @example * ```typescript * // Return the value in the tags field array at index specified by field * // 'favoriteTag'. * field('tags').arrayGet(field('favoriteTag')); * ``` * - * @param offsetExpr An Expr evaluating to the index of the element to return. - * @return A new Expr representing the 'arrayGet' operation. + * @param offsetExpr - An `Expression` evaluating to the index of the element to return. + * @returns A new `Expression` representing the 'arrayGet' operation. */ arrayGet(offsetExpr: Expression): FunctionExpression; arrayGet(offset: Expression | number): FunctionExpression { @@ -1820,12 +1907,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * * Creates an expression that checks if a given expression produces an error. * + * @example * ```typescript * // Check if the result of a calculation is an error * field("title").arrayContains(1).isError(); * ``` * - * @return A new {@code BooleanExpr} representing the 'isError' check. + * @returns A new {@link @firebase/firestore/pipelines#BooleanExpression} representing the 'isError' check. */ isError(): BooleanExpression { return new FunctionExpression('is_error', [this], 'isError').asBoolean(); @@ -1837,15 +1925,16 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that returns the result of the `catchExpr` argument * if there is an error, else return the result of this expression. * + * @example * ```typescript * // Returns the first item in the title field arrays, or returns * // the entire title field if the array is empty or the field is another type. * field("title").arrayGet(0).ifError(field("title")); * ``` * - * @param catchExpr The catch expression that will be evaluated and + * @param catchExpr - The catch expression that will be evaluated and * returned if this expression produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ ifError(catchExpr: Expression): FunctionExpression; @@ -1855,15 +1944,16 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that returns the `catch` argument if there is an * error, else return the result of this expression. * + * @example * ```typescript * // Returns the first item in the title field arrays, or returns * // "Default Title" * field("title").arrayGet(0).ifError("Default Title"); * ``` * - * @param catchValue The value that will be returned if this expression + * @param catchValue - The value that will be returned if this expression * produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ ifError(catchValue: unknown): FunctionExpression; ifError(catchValue: unknown): FunctionExpression | BooleanExpression { @@ -1884,12 +1974,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that returns `true` if the result of this expression * is absent. Otherwise, returns `false` even if the value is `null`. * + * @example * ```typescript * // Check if the field `value` is absent. * field("value").isAbsent(); + * @example * ``` * - * @return A new {@code BooleanExpr} representing the 'isAbsent' check. + * @returns A new {@link @firebase/firestore/pipelines#BooleanExpression} representing the 'isAbsent' check. */ isAbsent(): BooleanExpression { return new FunctionExpression('is_absent', [this], 'isAbsent').asBoolean(); @@ -1900,13 +1992,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * * Creates an expression that removes a key from the map produced by evaluating this expression. * + * @example * ``` * // Removes the key 'baz' from the input map. * map({foo: 'bar', baz: true}).mapRemove('baz'); * ``` * - * @param key The name of the key to remove from the input map. - * @returns A new {@code FirestoreFunction} representing the 'mapRemove' operation. + * @param key - The name of the key to remove from the input map. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'mapRemove' operation. */ mapRemove(key: string): FunctionExpression; /** @@ -1914,13 +2007,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * * Creates an expression that removes a key from the map produced by evaluating this expression. * + * @example * ``` * // Removes the key 'baz' from the input map. * map({foo: 'bar', baz: true}).mapRemove(constant('baz')); + * @example * ``` * - * @param keyExpr An expression that produces the name of the key to remove from the input map. - * @returns A new {@code FirestoreFunction} representing the 'mapRemove' operation. + * @param keyExpr - An expression that produces the name of the key to remove from the input map. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'mapRemove' operation. */ mapRemove(keyExpr: Expression): FunctionExpression; mapRemove(stringExpr: Expression | string): FunctionExpression { @@ -1936,18 +2031,19 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * * Creates an expression that merges multiple map values. * + * @example * ``` * // Merges the map in the settings field with, a map literal, and a map in * // that is conditionally returned by another expression * field('settings').mapMerge({ enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) * ``` * - * @param secondMap A required second map to merge. Represented as a literal or + * @param secondMap - A required second map to merge. Represented as a literal or * an expression that returns a map. - * @param otherMaps Optional additional maps to merge. Each map is represented + * @param otherMaps - Optional additional maps to merge. Each map is represented * as a literal or an expression that returns a map. * - * @returns A new {@code FirestoreFunction} representing the 'mapMerge' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'mapMerge' operation. */ mapMerge( secondMap: Record | Expression, @@ -1966,13 +2062,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that returns the value of this expression raised to the power of another expression. * + * @example * ```typescript * // Raise the value of the 'base' field to the power of the 'exponent' field. * field("base").pow(field("exponent")); * ``` * - * @param exponent The expression to raise this expression to the power of. - * @return A new `Expr` representing the power operation. + * @param exponent - The expression to raise this expression to the power of. + * @returns A new `Expression` representing the power operation. */ pow(exponent: Expression): FunctionExpression; @@ -1980,13 +2077,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that returns the value of this expression raised to the power of a constant value. * + * @example * ```typescript * // Raise the value of the 'base' field to the power of 2. * field("base").pow(2); * ``` * - * @param exponent The constant value to raise this expression to the power of. - * @return A new `Expr` representing the power operation. + * @param exponent - The constant value to raise this expression to the power of. + * @returns A new `Expression` representing the power operation. */ pow(exponent: number): FunctionExpression; pow(exponent: number | Expression): FunctionExpression { @@ -1997,40 +2095,43 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that rounds a numeric value to the nearest whole number. * + * @example * ```typescript * // Round the value of the 'price' field. * field("price").round(); * ``` * - * @return A new `Expr` representing the rounded value. + * @returns A new `Expression` representing the rounded value. */ round(): FunctionExpression; /** * @beta * Creates an expression that rounds a numeric value to the specified number of decimal places. * + * @example * ```typescript * // Round the value of the 'price' field to two decimal places. * field("price").round(2); * ``` * - * @param decimalPlaces A constant specifying the rounding precision in decimal places. + * @param decimalPlaces - A constant specifying the rounding precision in decimal places. * - * @return A new `Expr` representing the rounded value. + * @returns A new `Expression` representing the rounded value. */ round(decimalPlaces: number): FunctionExpression; /** * @beta * Creates an expression that rounds a numeric value to the specified number of decimal places. * + * @example * ```typescript * // Round the value of the 'price' field to two decimal places. * field("price").round(constant(2)); * ``` * - * @param decimalPlaces An expression specifying the rounding precision in decimal places. + * @param decimalPlaces - An expression specifying the rounding precision in decimal places. * - * @return A new `Expr` representing the rounded value. + * @returns A new `Expression` representing the rounded value. */ round(decimalPlaces: Expression): FunctionExpression; round(decimalPlaces?: number | Expression): FunctionExpression { @@ -2049,12 +2150,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that returns the collection ID from a path. * + * @example * ```typescript * // Get the collection ID from a path. * field("__path__").collectionId(); * ``` * - * @return A new {@code Expr} representing the collectionId operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the collectionId operation. */ collectionId(): FunctionExpression { return new FunctionExpression('collection_id', [this]); @@ -2064,6 +2166,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that calculates the length of a string, array, map, vector, or bytes. * + * @example * ```typescript * // Get the length of the 'name' field. * field("name").length(); @@ -2072,7 +2175,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * field("cart").length(); * ``` * - * @return A new `Expr` representing the length of the string, array, map, vector, or bytes. + * @returns A new `Expression` representing the length of the string, array, map, vector, or bytes. */ length(): FunctionExpression { return new FunctionExpression('length', [this]); @@ -2082,12 +2185,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes the natural logarithm of a numeric value. * + * @example * ```typescript * // Compute the natural logarithm of the 'value' field. * field("value").ln(); * ``` * - * @return A new {@code Expr} representing the natural logarithm of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the natural logarithm of the numeric value. */ ln(): FunctionExpression { return new FunctionExpression('ln', [this]); @@ -2097,12 +2201,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes the square root of a numeric value. * + * @example * ```typescript * // Compute the square root of the 'value' field. * field("value").sqrt(); * ``` * - * @return A new {@code Expr} representing the square root of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the square root of the numeric value. */ sqrt(): FunctionExpression { return new FunctionExpression('sqrt', [this]); @@ -2112,12 +2217,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that reverses a string. * + * @example * ```typescript * // Reverse the value of the 'myString' field. * field("myString").stringReverse(); * ``` * - * @return A new {@code Expr} representing the reversed string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string. */ stringReverse(): FunctionExpression { return new FunctionExpression('string_reverse', [this]); @@ -2128,14 +2234,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Creates an expression that returns the `elseValue` argument if this expression results in an absent value, else * return the result of the this expression evaluation. * + * @example * ```typescript * // Returns the value of the optional field 'optional_field', or returns 'default_value' * // if the field is absent. * field("optional_field").ifAbsent("default_value") * ``` * - * @param elseValue The value that will be returned if this Expression evaluates to an absent value. - * @return A new [Expression] representing the ifAbsent operation. + * @param elseValue - The value that will be returned if this Expression evaluates to an absent value. + * @returns A new [Expression] representing the ifAbsent operation. */ ifAbsent(elseValue: unknown): Expression; @@ -2150,8 +2257,8 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * field("optional_field").ifAbsent(field('default_field')) * ``` * - * @param elseExpression The Expression that will be evaluated if this Expression evaluates to an absent value. - * @return A new [Expression] representing the ifAbsent operation. + * @param elseExpression - The Expression that will be evaluated if this Expression evaluates to an absent value. + * @returns A new [Expression] representing the ifAbsent operation. */ ifAbsent(elseExpression: unknown): Expression; @@ -2167,13 +2274,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that joins the elements of an array into a string. * + * @example * ```typescript * // Join the elements of the 'tags' field with the delimiter from the 'separator' field. * field("tags").join(field("separator")) * ``` * - * @param delimiterExpression The expression that evaluates to the delimiter string. - * @return A new Expression representing the join operation. + * @param delimiterExpression - The expression that evaluates to the delimiter string. + * @returns A new Expression representing the join operation. */ join(delimiterExpression: Expression): Expression; @@ -2181,13 +2289,14 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that joins the elements of an array field into a string. * + * @example * ```typescript * // Join the elements of the 'tags' field with a comma and space. * field("tags").join(", ") * ``` * - * @param delimiter The string to use as a delimiter. - * @return A new Expression representing the join operation. + * @param delimiter - The string to use as a delimiter. + * @returns A new Expression representing the join operation. */ join(delimiter: string): Expression; @@ -2203,12 +2312,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes the base-10 logarithm of a numeric value. * + * @example * ```typescript * // Compute the base-10 logarithm of the 'value' field. * field("value").log10(); * ``` * - * @return A new {@code Expr} representing the base-10 logarithm of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the base-10 logarithm of the numeric value. */ log10(): FunctionExpression { return new FunctionExpression('log10', [this]); @@ -2218,12 +2328,13 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * @beta * Creates an expression that computes the sum of the elements in an array. * + * @example * ```typescript * // Compute the sum of the elements in the 'scores' field. * field("scores").arraySum(); * ``` * - * @return A new {@code Expr} representing the sum of the elements in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the sum of the elements in the array. */ arraySum(): FunctionExpression { return new FunctionExpression('sum', [this]); @@ -2240,7 +2351,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * field('scoresCsv').split(',') * ``` * - * @return A new {@code Expression} representing the split function. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function. */ split(delimiter: string): FunctionExpression; @@ -2255,7 +2366,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * field('scores').split(conditional(field('format').equal('csv'), constant(','), constant(':')) * ``` * - * @return A new {@code Expression} representing the split function. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function. */ split(delimiter: Expression): FunctionExpression; split(delimiter: string | Expression): FunctionExpression { @@ -2274,10 +2385,10 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * field('createdAt').timestampTruncate('day') * ``` * - * @param granularity The granularity to truncate to. - * @param timezone The timezone to use for truncation. Valid values are from + * @param granularity - The granularity to truncate to. + * @param timezone - The timezone to use for truncation. Valid values are from * the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". - * @return A new {Expression} representing the truncated timestamp. + * @returns A new `Expression` representing the truncated timestamp. */ timestampTruncate( granularity: TimeGranularity, @@ -2293,10 +2404,10 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * field('createdAt').timestampTruncate(field('granularity')) * ``` * - * @param granularity The granularity to truncate to. - * @param timezone The timezone to use for truncation. Valid values are from + * @param granularity - The granularity to truncate to. + * @param timezone - The timezone to use for truncation. Valid values are from * the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". - * @return A new {Expression} representing the truncated timestamp. + * @returns A new `Expression` representing the truncated timestamp. */ timestampTruncate( granularity: Expression, @@ -2327,7 +2438,7 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * field('title').type() * ``` * - * @return A new {Expression} representing the data type. + * @returns A new `Expression` representing the data type. */ type(): FunctionExpression { return new FunctionExpression('type', [this]); @@ -2337,15 +2448,16 @@ export abstract class Expression implements ProtoValueSerializable, UserData { /** * @beta - * Creates an {@link Ordering} that sorts documents in ascending order based on this expression. + * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in ascending order based on this expression. * + * @example * ```typescript * // Sort documents by the 'name' field in ascending order * pipeline().collection("users") * .sort(field("name").ascending()); * ``` * - * @return A new `Ordering` for ascending sorting. + * @returns A new `Ordering` for ascending sorting. */ ascending(): Ordering { return ascending(this); @@ -2353,15 +2465,16 @@ export abstract class Expression implements ProtoValueSerializable, UserData { /** * @beta - * Creates an {@link Ordering} that sorts documents in descending order based on this expression. + * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in descending order based on this expression. * + * @example * ```typescript * // Sort documents by the 'createdAt' field in descending order * firestore.pipeline().collection("users") * .sort(field("createdAt").descending()); * ``` * - * @return A new `Ordering` for descending sorting. + * @returns A new `Ordering` for descending sorting. */ descending(): Ordering { return descending(this); @@ -2374,14 +2487,15 @@ export abstract class Expression implements ProtoValueSerializable, UserData { * Aliases are useful for renaming fields in the output of a stage or for giving meaningful * names to calculated values. * + * @example * ```typescript * // Calculate the total price and assign it the alias "totalPrice" and add it to the output. * firestore.pipeline().collection("items") * .addFields(field("price").multiply(field("quantity")).as("totalPrice")); * ``` * - * @param name The alias to assign to this expression. - * @return A new {@link AliasedExpression} that wraps this + * @param name - The alias to assign to this expression. + * @returns A new {@link @firebase/firestore/pipelines#AliasedExpression} that wraps this * expression and associates it with the provided alias. */ as(name: string): AliasedExpression { @@ -2468,14 +2582,15 @@ export class AggregateFunction implements ProtoValueSerializable, UserData { * Assigns an alias to this AggregateFunction. The alias specifies the name that * the aggregated value will have in the output document. * + * @example * ```typescript * // Calculate the average price of all items and assign it the alias "averagePrice". * firestore.pipeline().collection("items") * .aggregate(field("price").average().as("averagePrice")); * ``` * - * @param name The alias to assign to this AggregateFunction. - * @return A new {@link AliasedAggregate} that wraps this + * @param name - The alias to assign to this AggregateFunction. + * @returns A new {@link @firebase/firestore/pipelines#AliasedAggregate} that wraps this * AggregateFunction and associates it with the provided alias. */ as(name: string): AliasedAggregate { @@ -2591,13 +2706,14 @@ class ListOfExprs extends Expression implements UserData { /** * @beta * - * Represents a reference to a field in a Firestore document, or outputs of a {@link Pipeline} stage. + * Represents a reference to a field in a Firestore document, or outputs of a {@link @firebase/firestore/pipelines#Pipeline} stage. * *

Field references are used to access document field values in expressions and to specify fields * for sorting, filtering, and projecting data in Firestore pipelines. * - *

You can create a `Field` instance using the static {@link #of} method: + *

You can create a `Field` instance using the static {@link @firebase/firestore/pipelines#field} method: * + * @example * ```typescript * // Create a Field instance for the 'name' field * const nameField = field("name"); @@ -2654,11 +2770,12 @@ export class Field extends Expression implements Selectable { /** * @beta - * Creates a {@code Field} instance representing the field at the given path. + * Creates a {@link @firebase/firestore/pipelines#Field} instance representing the field at the given path. * * The path can be a simple field name (e.g., "name") or a dot-separated path to a nested field * (e.g., "address.city"). * + * @example * ```typescript * // Create a Field instance for the 'title' field * const titleField = field("title"); @@ -2667,17 +2784,17 @@ export class Field extends Expression implements Selectable { * const authorFirstNameField = field("author.firstName"); * ``` * - * @param name The path to the field. - * @return A new {@code Field} instance representing the specified field. + * @param name - The path to the field. + * @returns A new {@link @firebase/firestore/pipelines#Field} instance representing the specified field. */ export function field(name: string): Field; /** * @beta - * Creates a {@code Field} instance representing the field at the given path. + * Creates a {@link @firebase/firestore/pipelines#Field} instance representing the field at the given path. * - * @param path A FieldPath specifying the field. - * @return A new {@code Field} instance representing the specified field. + * @param path - A FieldPath specifying the field. + * @returns A new {@link @firebase/firestore/pipelines#Field} instance representing the specified field. */ export function field(path: FieldPath): Field; export function field(nameOrPath: string | FieldPath): Field { @@ -2703,8 +2820,9 @@ export function _field( * * Represents a constant value that can be used in a Firestore pipeline expression. * - * You can create a `Constant` instance using the static {@link #of} method: + * You can create a `Constant` instance using the static {@link @firebase/firestore/pipelines#field} method: * + * @example * ```typescript * // Create a Constant instance for the number 10 * const ten = constant(10); @@ -2722,7 +2840,7 @@ export class Constant extends Expression { * @private * @internal * @hideconstructor - * @param value The value of the constant. + * @param value - The value of the constant. */ constructor( private value: unknown, @@ -2774,8 +2892,8 @@ export class Constant extends Expression { * @beta * Creates a `Constant` instance for a number value. * - * @param value The number value. - * @return A new `Constant` instance. + * @param value - The number value. + * @returns A new `Constant` instance. */ export function constant(value: number): Expression; @@ -2783,8 +2901,8 @@ export function constant(value: number): Expression; * @beta * Creates a `Constant` instance for a string value. * - * @param value The string value. - * @return A new `Constant` instance. + * @param value - The string value. + * @returns A new `Constant` instance. */ export function constant(value: string): Expression; @@ -2792,8 +2910,8 @@ export function constant(value: string): Expression; * @beta * Creates a `BooleanExpression` instance for a boolean value. * - * @param value The boolean value. - * @return A new `Constant` instance. + * @param value - The boolean value. + * @returns A new `Constant` instance. */ export function constant(value: boolean): BooleanExpression; @@ -2801,8 +2919,8 @@ export function constant(value: boolean): BooleanExpression; * @beta * Creates a `Constant` instance for a null value. * - * @param value The null value. - * @return A new `Constant` instance. + * @param value - The null value. + * @returns A new `Constant` instance. */ export function constant(value: null): Expression; @@ -2810,8 +2928,8 @@ export function constant(value: null): Expression; * @beta * Creates a `Constant` instance for a GeoPoint value. * - * @param value The GeoPoint value. - * @return A new `Constant` instance. + * @param value - The GeoPoint value. + * @returns A new `Constant` instance. */ export function constant(value: GeoPoint): Expression; @@ -2819,8 +2937,8 @@ export function constant(value: GeoPoint): Expression; * @beta * Creates a `Constant` instance for a Timestamp value. * - * @param value The Timestamp value. - * @return A new `Constant` instance. + * @param value - The Timestamp value. + * @returns A new `Constant` instance. */ export function constant(value: Timestamp): Expression; @@ -2828,8 +2946,8 @@ export function constant(value: Timestamp): Expression; * @beta * Creates a `Constant` instance for a Date value. * - * @param value The Date value. - * @return A new `Constant` instance. + * @param value - The Date value. + * @returns A new `Constant` instance. */ export function constant(value: Date): Expression; @@ -2837,8 +2955,8 @@ export function constant(value: Date): Expression; * @beta * Creates a `Constant` instance for a Bytes value. * - * @param value The Bytes value. - * @return A new `Constant` instance. + * @param value - The Bytes value. + * @returns A new `Constant` instance. */ export function constant(value: Bytes): Expression; @@ -2846,8 +2964,8 @@ export function constant(value: Bytes): Expression; * @beta * Creates a `Constant` instance for a DocumentReference value. * - * @param value The DocumentReference value. - * @return A new `Constant` instance. + * @param value - The DocumentReference value. + * @returns A new `Constant` instance. */ export function constant(value: DocumentReference): Expression; @@ -2856,8 +2974,8 @@ export function constant(value: DocumentReference): Expression; * For internal use only. * @private * @internal - * @param value The Firestore proto value. - * @return A new `Constant` instance. + * @param value - The Firestore proto value. + * @returns A new `Constant` instance. */ export function constant(value: ProtoValue): Expression; @@ -2865,8 +2983,8 @@ export function constant(value: ProtoValue): Expression; * @beta * Creates a `Constant` instance for a VectorValue value. * - * @param value The VectorValue value. - * @return A new `Constant` instance. + * @param value - The VectorValue value. + * @returns A new `Constant` instance. */ export function constant(value: VectorValue): Expression; @@ -2924,11 +3042,11 @@ export class MapValue extends Expression { /** * @beta * - * This class defines the base class for Firestore {@link Pipeline} functions, which can be evaluated within pipeline + * This class defines the base class for Firestore {@link @firebase/firestore/pipelines#Pipeline} functions, which can be evaluated within pipeline * execution. * - * Typically, you would not use this class or its children directly. Use either the functions like {@link and}, {@link equal}, - * or the methods on {@link Expression} ({@link Expression#equal}, {@link Expression#lessThan}, etc.) to construct new Function instances. + * Typically, you would not use this class or its children directly. Use either the functions like {@link @firebase/firestore/pipelines#and}, {@link @firebase/firestore/pipelines#(equal:1)}, + * or the methods on {@link @firebase/firestore/pipelines#Expression} ({@link @firebase/firestore/pipelines#Expression.(equal:1)}, {@link @firebase/firestore/pipelines#Expression.(lessThan:1)}, etc.) to construct new Function instances. */ export class FunctionExpression extends Expression { readonly expressionType: ExpressionType = 'Function'; @@ -2991,12 +3109,13 @@ export abstract class BooleanExpression extends Expression { * Creates an aggregation that finds the count of input documents satisfying * this boolean expression. * + * @example * ```typescript * // Find the count of documents with a score greater than 90 * field("score").greaterThan(90).countIf().as("highestScore"); * ``` * - * @return A new `AggregateFunction` representing the 'countIf' aggregation. + * @returns A new `AggregateFunction` representing the 'countIf' aggregation. */ countIf(): AggregateFunction { return AggregateFunction._create('count_if', [this], 'countIf'); @@ -3006,12 +3125,13 @@ export abstract class BooleanExpression extends Expression { * @beta * Creates an expression that negates this boolean expression. * + * @example * ```typescript * // Find documents where the 'tags' field does not contain 'completed' * field("tags").arrayContains("completed").not(); * ``` * - * @return A new {@code Expr} representing the negated filter condition. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the negated filter condition. */ not(): BooleanExpression { return new FunctionExpression('not', [this], 'not').asBoolean(); @@ -3023,14 +3143,15 @@ export abstract class BooleanExpression extends Expression { * if `this` expression evaluates to `true`, * or evaluates to the 'else' expression if `this` expressions evaluates `false`. * + * @example * ```typescript * // If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". * field("age").greaterThanOrEqual(18).conditional(constant("Adult"), constant("Minor")); * ``` * - * @param thenExpr The expression to evaluate if the condition is true. - * @param elseExpr The expression to evaluate if the condition is false. - * @return A new {@code Expr} representing the conditional expression. + * @param thenExpr - The expression to evaluate if the condition is true. + * @param elseExpr - The expression to evaluate if the condition is false. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the conditional expression. */ conditional(thenExpr: Expression, elseExpr: Expression): FunctionExpression { return new FunctionExpression( @@ -3046,15 +3167,16 @@ export abstract class BooleanExpression extends Expression { * Creates an expression that returns the `catch` argument if there is an * error, else return the result of this expression. * + * @example * ```typescript * // Create an expression that protects against a divide by zero error * // but always returns a boolean expression. * constant(50).divide('length').gt(1).ifError(constant(false)); * ``` * - * @param catchValue The value that will be returned if this expression + * @param catchValue - The value that will be returned if this expression * produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ ifError(catchValue: BooleanExpression): BooleanExpression; @@ -3064,15 +3186,16 @@ export abstract class BooleanExpression extends Expression { * Creates an expression that returns the `catch` argument if there is an * error, else return the result of this expression. * + * @example * ```typescript * // Create an expression that protects against a divide by zero error * // but always returns a boolean expression. * constant(50).divide('length').gt(1).ifError(false); * ``` * - * @param catchValue The value that will be returned if this expression + * @param catchValue - The value that will be returned if this expression * produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ ifError(catchValue: boolean): BooleanExpression; @@ -3082,14 +3205,15 @@ export abstract class BooleanExpression extends Expression { * Creates an expression that returns the `catch` argument if there is an * error, else return the result of this expression. * + * @example * ```typescript * // Create an expression that protects against a divide by zero error. * constant(50).divide('length').gt(1).ifError(constant(0)); * ``` * - * @param catchValue The value that will be returned if this expression + * @param catchValue - The value that will be returned if this expression * produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ ifError(catchValue: Expression): FunctionExpression; @@ -3099,14 +3223,15 @@ export abstract class BooleanExpression extends Expression { * Creates an expression that returns the `catch` argument if there is an * error, else return the result of this expression. * + * @example * ```typescript * // Create an expression that protects against a divide by zero error. * constant(50).divide('length').gt(1).ifError(0); * ``` * - * @param catchValue The value that will be returned if this expression + * @param catchValue - The value that will be returned if this expression * produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ ifError(catchValue: unknown): FunctionExpression; ifError(catchValue: unknown): unknown { @@ -3165,6 +3290,7 @@ export class BooleanField extends BooleanExpression { * Creates an aggregation that counts the number of stage inputs where the provided * boolean expression evaluates to true. * + * @example * ```typescript * // Count the number of documents where 'is_active' field equals true * countIf(field("is_active").equal(true)).as("numActiveDocuments"); @@ -3183,14 +3309,15 @@ export function countIf(booleanExpr: BooleanExpression): AggregateFunction { * and return the element. If the offset exceeds the array length, an error is * returned. A negative offset, starts from the end. * + * @example * ```typescript * // Return the value in the tags field array at index 1. * arrayGet('tags', 1); * ``` * - * @param arrayField The name of the array field. - * @param offset The index of the element to return. - * @return A new Expr representing the 'arrayGet' operation. + * @param arrayField - The name of the array field. + * @param offset - The index of the element to return. + * @returns A new `Expression` representing the 'arrayGet' operation. */ export function arrayGet( arrayField: string, @@ -3203,15 +3330,16 @@ export function arrayGet( * and return the element. If the offset exceeds the array length, an error is * returned. A negative offset, starts from the end. * + * @example * ```typescript * // Return the value in the tags field array at index specified by field * // 'favoriteTag'. * arrayGet('tags', field('favoriteTag')); * ``` * - * @param arrayField The name of the array field. - * @param offsetExpr An Expr evaluating to the index of the element to return. - * @return A new Expr representing the 'arrayGet' operation. + * @param arrayField - The name of the array field. + * @param offsetExpr - An `Expression` evaluating to the index of the element to return. + * @returns A new `Expression` representing the 'arrayGet' operation. */ export function arrayGet( arrayField: string, @@ -3224,14 +3352,15 @@ export function arrayGet( * and return the element. If the offset exceeds the array length, an error is * returned. A negative offset, starts from the end. * + * @example * ```typescript * // Return the value in the tags field array at index 1. * arrayGet(field('tags'), 1); * ``` * - * @param arrayExpression An Expr evaluating to an array. - * @param offset The index of the element to return. - * @return A new Expr representing the 'arrayGet' operation. + * @param arrayExpression - An `Expression` evaluating to an array. + * @param offset - The index of the element to return. + * @returns A new `Expression` representing the 'arrayGet' operation. */ export function arrayGet( arrayExpression: Expression, @@ -3244,15 +3373,16 @@ export function arrayGet( * and return the element. If the offset exceeds the array length, an error is * returned. A negative offset, starts from the end. * + * @example * ```typescript * // Return the value in the tags field array at index specified by field * // 'favoriteTag'. * arrayGet(field('tags'), field('favoriteTag')); * ``` * - * @param arrayExpression An Expr evaluating to an array. - * @param offsetExpr An Expr evaluating to the index of the element to return. - * @return A new Expr representing the 'arrayGet' operation. + * @param arrayExpression - An `Expression` evaluating to an array. + * @param offsetExpr - An `Expression` evaluating to the index of the element to return. + * @returns A new `Expression` representing the 'arrayGet' operation. */ export function arrayGet( arrayExpression: Expression, @@ -3270,13 +3400,14 @@ export function arrayGet( * * Creates an expression that checks if a given expression produces an error. * + * @example * ```typescript * // Check if the result of a calculation is an error * isError(field("title").arrayContains(1)); * ``` * - * @param value The expression to check. - * @return A new {@code Expr} representing the 'isError' check. + * @param value - The expression to check. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'isError' check. */ export function isError(value: Expression): BooleanExpression { return value.isError().asBoolean(); @@ -3290,16 +3421,17 @@ export function isError(value: Expression): BooleanExpression { * * This overload is useful when a BooleanExpression is required. * + * @example * ```typescript * // Create an expression that protects against a divide by zero error * // but always returns a boolean expression. * ifError(constant(50).divide('length').gt(1), constant(false)); * ``` * - * @param tryExpr The try expression. - * @param catchExpr The catch expression that will be evaluated and + * @param tryExpr - The try expression. + * @param catchExpr - The catch expression that will be evaluated and * returned if the tryExpr produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ export function ifError( tryExpr: BooleanExpression, @@ -3312,16 +3444,17 @@ export function ifError( * Creates an expression that returns the `catch` argument if there is an * error, else return the result of the `try` argument evaluation. * + * @example * ```typescript * // Returns the first item in the title field arrays, or returns * // the entire title field if the array is empty or the field is another type. * ifError(field("title").arrayGet(0), field("title")); * ``` * - * @param tryExpr The try expression. - * @param catchExpr The catch expression that will be evaluated and + * @param tryExpr - The try expression. + * @param catchExpr - The catch expression that will be evaluated and * returned if the tryExpr produces an error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ export function ifError( tryExpr: Expression, @@ -3334,16 +3467,17 @@ export function ifError( * Creates an expression that returns the `catch` argument if there is an * error, else return the result of the `try` argument evaluation. * + * @example * ```typescript * // Returns the first item in the title field arrays, or returns * // "Default Title" * ifError(field("title").arrayGet(0), "Default Title"); * ``` * - * @param tryExpr The try expression. - * @param catchValue The value that will be returned if the tryExpr produces an + * @param tryExpr - The try expression. + * @param catchValue - The value that will be returned if the tryExpr produces an * error. - * @return A new {@code Expr} representing the 'ifError' operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ifError' operation. */ export function ifError( tryExpr: Expression, @@ -3370,13 +3504,14 @@ export function ifError( * Creates an expression that returns `true` if a value is absent. Otherwise, * returns `false` even if the value is `null`. * + * @example * ```typescript * // Check if the field `value` is absent. * isAbsent(field("value")); * ``` * - * @param value The expression to check. - * @return A new {@code Expr} representing the 'isAbsent' check. + * @param value - The expression to check. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'isAbsent' check. */ export function isAbsent(value: Expression): BooleanExpression; @@ -3386,13 +3521,14 @@ export function isAbsent(value: Expression): BooleanExpression; * Creates an expression that returns `true` if a field is absent. Otherwise, * returns `false` even if the field value is `null`. * + * @example * ```typescript * // Check if the field `value` is absent. * isAbsent("value"); * ``` * - * @param field The field to check. - * @return A new {@code Expr} representing the 'isAbsent' check. + * @param field - The field to check. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'isAbsent' check. */ export function isAbsent(field: string): BooleanExpression; export function isAbsent(value: Expression | string): BooleanExpression { @@ -3404,13 +3540,14 @@ export function isAbsent(value: Expression | string): BooleanExpression { * * Creates an expression that removes a key from the map at the specified field name. * + * @example * ``` * // Removes the key 'city' field from the map in the address field of the input document. * mapRemove('address', 'city'); * ``` * - * @param mapField The name of a field containing a map value. - * @param key The name of the key to remove from the input map. + * @param mapField - The name of a field containing a map value. + * @param key - The name of the key to remove from the input map. */ export function mapRemove(mapField: string, key: string): FunctionExpression; /** @@ -3418,13 +3555,15 @@ export function mapRemove(mapField: string, key: string): FunctionExpression; * * Creates an expression that removes a key from the map produced by evaluating an expression. * + * @example * ``` * // Removes the key 'baz' from the input map. * mapRemove(map({foo: 'bar', baz: true}), 'baz'); + * @example * ``` * - * @param mapExpr An expression return a map value. - * @param key The name of the key to remove from the input map. + * @param mapExpr - An expression return a map value. + * @param key - The name of the key to remove from the input map. */ export function mapRemove(mapExpr: Expression, key: string): FunctionExpression; /** @@ -3432,13 +3571,14 @@ export function mapRemove(mapExpr: Expression, key: string): FunctionExpression; * * Creates an expression that removes a key from the map at the specified field name. * + * @example * ``` * // Removes the key 'city' field from the map in the address field of the input document. * mapRemove('address', constant('city')); * ``` * - * @param mapField The name of a field containing a map value. - * @param keyExpr An expression that produces the name of the key to remove from the input map. + * @param mapField - The name of a field containing a map value. + * @param keyExpr - An expression that produces the name of the key to remove from the input map. */ export function mapRemove( mapField: string, @@ -3449,13 +3589,15 @@ export function mapRemove( * * Creates an expression that removes a key from the map produced by evaluating an expression. * + * @example * ``` * // Removes the key 'baz' from the input map. * mapRemove(map({foo: 'bar', baz: true}), constant('baz')); + * @example * ``` * - * @param mapExpr An expression return a map value. - * @param keyExpr An expression that produces the name of the key to remove from the input map. + * @param mapExpr - An expression return a map value. + * @param keyExpr - An expression that produces the name of the key to remove from the input map. */ export function mapRemove( mapExpr: Expression, @@ -3474,16 +3616,17 @@ export function mapRemove( * * Creates an expression that merges multiple map values. * + * @example * ``` * // Merges the map in the settings field with, a map literal, and a map in * // that is conditionally returned by another expression * mapMerge('settings', { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) * ``` * - * @param mapField Name of a field containing a map value that will be merged. - * @param secondMap A required second map to merge. Represented as a literal or + * @param mapField - Name of a field containing a map value that will be merged. + * @param secondMap - A required second map to merge. Represented as a literal or * an expression that returns a map. - * @param otherMaps Optional additional maps to merge. Each map is represented + * @param otherMaps - Optional additional maps to merge. Each map is represented * as a literal or an expression that returns a map. */ export function mapMerge( @@ -3497,16 +3640,17 @@ export function mapMerge( * * Creates an expression that merges multiple map values. * + * @example * ``` * // Merges the map in the settings field with, a map literal, and a map in * // that is conditionally returned by another expression * mapMerge(field('settings'), { enabled: true }, conditional(field('isAdmin'), { admin: true}, {}) * ``` * - * @param firstMap An expression or literal map value that will be merged. - * @param secondMap A required second map to merge. Represented as a literal or + * @param firstMap - An expression or literal map value that will be merged. + * @param secondMap - A required second map to merge. Represented as a literal or * an expression that returns a map. - * @param otherMaps Optional additional maps to merge. Each map is represented + * @param otherMaps - Optional additional maps to merge. Each map is represented * as a literal or an expression that returns a map. */ export function mapMerge( @@ -3530,12 +3674,13 @@ export function mapMerge( * * Creates an expression that returns the document ID from a path. * + * @example * ```typescript * // Get the document ID from a path. * documentId(myDocumentReference); * ``` * - * @return A new {@code Expr} representing the documentId operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the documentId operation. */ export function documentId( documentPath: string | DocumentReference @@ -3546,12 +3691,13 @@ export function documentId( * * Creates an expression that returns the document ID from a path. * + * @example * ```typescript * // Get the document ID from a path. * documentId(field("__path__")); * ``` * - * @return A new {@code Expr} representing the documentId operation. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the documentId operation. */ export function documentId(documentPathExpr: Expression): FunctionExpression; @@ -3568,9 +3714,9 @@ export function documentId( * * Creates an expression that returns a substring of a string or byte array. * - * @param field The name of a field containing a string or byte array to compute the substring from. - * @param position Index of the first character of the substring. - * @param length Length of the substring. + * @param field - The name of a field containing a string or byte array to compute the substring from. + * @param position - Index of the first character of the substring. + * @param length - Length of the substring. */ export function substring( field: string, @@ -3583,9 +3729,9 @@ export function substring( * * Creates an expression that returns a substring of a string or byte array. * - * @param input An expression returning a string or byte array to compute the substring from. - * @param position Index of the first character of the substring. - * @param length Length of the substring. + * @param input - An expression returning a string or byte array to compute the substring from. + * @param position - Index of the first character of the substring. + * @param length - Length of the substring. */ export function substring( input: Expression, @@ -3598,9 +3744,9 @@ export function substring( * * Creates an expression that returns a substring of a string or byte array. * - * @param field The name of a field containing a string or byte array to compute the substring from. - * @param position An expression that returns the index of the first character of the substring. - * @param length An expression that returns the length of the substring. + * @param field - The name of a field containing a string or byte array to compute the substring from. + * @param position - An expression that returns the index of the first character of the substring. + * @param length - An expression that returns the length of the substring. */ export function substring( field: string, @@ -3613,9 +3759,9 @@ export function substring( * * Creates an expression that returns a substring of a string or byte array. * - * @param input An expression returning a string or byte array to compute the substring from. - * @param position An expression that returns the index of the first character of the substring. - * @param length An expression that returns the length of the substring. + * @param input - An expression returning a string or byte array to compute the substring from. + * @param position - An expression that returns the index of the first character of the substring. + * @param length - An expression that returns the length of the substring. */ export function substring( input: Expression, @@ -3640,15 +3786,16 @@ export function substring( * * Creates an expression that adds two expressions together. * + * @example * ```typescript * // Add the value of the 'quantity' field and the 'reserve' field. * add(field("quantity"), field("reserve")); * ``` * - * @param first The first expression to add. - * @param second The second expression or literal to add. - * @param others Optional other expressions or literals to add. - * @return A new {@code Expr} representing the addition operation. + * @param first - The first expression to add. + * @param second - The second expression or literal to add. + * @param others - Optional other expressions or literals to add. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the addition operation. */ export function add( first: Expression, @@ -3660,15 +3807,16 @@ export function add( * * Creates an expression that adds a field's value to an expression. * + * @example * ```typescript * // Add the value of the 'quantity' field and the 'reserve' field. * add("quantity", field("reserve")); * ``` * - * @param fieldName The name of the field containing the value to add. - * @param second The second expression or literal to add. - * @param others Optional other expressions or literals to add. - * @return A new {@code Expr} representing the addition operation. + * @param fieldName - The name of the field containing the value to add. + * @param second - The second expression or literal to add. + * @param others - Optional other expressions or literals to add. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the addition operation. */ export function add( fieldName: string, @@ -3687,14 +3835,15 @@ export function add( * * Creates an expression that subtracts two expressions. * + * @example * ```typescript * // Subtract the 'discount' field from the 'price' field * subtract(field("price"), field("discount")); * ``` * - * @param left The expression to subtract from. - * @param right The expression to subtract. - * @return A new {@code Expr} representing the subtraction operation. + * @param left - The expression to subtract from. + * @param right - The expression to subtract. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation. */ export function subtract( left: Expression, @@ -3706,14 +3855,15 @@ export function subtract( * * Creates an expression that subtracts a constant value from an expression. * + * @example * ```typescript * // Subtract the constant value 2 from the 'value' field * subtract(field("value"), 2); * ``` * - * @param expression The expression to subtract from. - * @param value The constant value to subtract. - * @return A new {@code Expr} representing the subtraction operation. + * @param expression - The expression to subtract from. + * @param value - The constant value to subtract. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation. */ export function subtract( expression: Expression, @@ -3725,14 +3875,15 @@ export function subtract( * * Creates an expression that subtracts an expression from a field's value. * + * @example * ```typescript * // Subtract the 'discount' field from the 'price' field * subtract("price", field("discount")); * ``` * - * @param fieldName The field name to subtract from. - * @param expression The expression to subtract. - * @return A new {@code Expr} representing the subtraction operation. + * @param fieldName - The field name to subtract from. + * @param expression - The expression to subtract. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation. */ export function subtract( fieldName: string, @@ -3744,14 +3895,15 @@ export function subtract( * * Creates an expression that subtracts a constant value from a field's value. * + * @example * ```typescript * // Subtract 20 from the value of the 'total' field * subtract("total", 20); * ``` * - * @param fieldName The field name to subtract from. - * @param value The constant value to subtract. - * @return A new {@code Expr} representing the subtraction operation. + * @param fieldName - The field name to subtract from. + * @param value - The constant value to subtract. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the subtraction operation. */ export function subtract(fieldName: string, value: unknown): FunctionExpression; export function subtract( @@ -3768,15 +3920,16 @@ export function subtract( * * Creates an expression that multiplies two expressions together. * + * @example * ```typescript * // Multiply the 'quantity' field by the 'price' field * multiply(field("quantity"), field("price")); * ``` * - * @param first The first expression to multiply. - * @param second The second expression or literal to multiply. - * @param others Optional additional expressions or literals to multiply. - * @return A new {@code Expr} representing the multiplication operation. + * @param first - The first expression to multiply. + * @param second - The second expression or literal to multiply. + * @param others - Optional additional expressions or literals to multiply. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the multiplication operation. */ export function multiply( first: Expression, @@ -3788,15 +3941,16 @@ export function multiply( * * Creates an expression that multiplies a field's value by an expression. * + * @example * ```typescript * // Multiply the 'quantity' field by the 'price' field * multiply("quantity", field("price")); * ``` * - * @param fieldName The name of the field containing the value to add. - * @param second The second expression or literal to add. - * @param others Optional other expressions or literals to add. - * @return A new {@code Expr} representing the multiplication operation. + * @param fieldName - The name of the field containing the value to add. + * @param second - The second expression or literal to add. + * @param others - Optional other expressions or literals to add. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the multiplication operation. */ export function multiply( fieldName: string, @@ -3815,14 +3969,15 @@ export function multiply( * * Creates an expression that divides two expressions. * + * @example * ```typescript * // Divide the 'total' field by the 'count' field * divide(field("total"), field("count")); * ``` * - * @param left The expression to be divided. - * @param right The expression to divide by. - * @return A new {@code Expr} representing the division operation. + * @param left - The expression to be divided. + * @param right - The expression to divide by. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation. */ export function divide(left: Expression, right: Expression): FunctionExpression; @@ -3831,14 +3986,15 @@ export function divide(left: Expression, right: Expression): FunctionExpression; * * Creates an expression that divides an expression by a constant value. * + * @example * ```typescript * // Divide the 'value' field by 10 * divide(field("value"), 10); * ``` * - * @param expression The expression to be divided. - * @param value The constant value to divide by. - * @return A new {@code Expr} representing the division operation. + * @param expression - The expression to be divided. + * @param value - The constant value to divide by. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation. */ export function divide( expression: Expression, @@ -3850,14 +4006,15 @@ export function divide( * * Creates an expression that divides a field's value by an expression. * + * @example * ```typescript * // Divide the 'total' field by the 'count' field * divide("total", field("count")); * ``` * - * @param fieldName The field name to be divided. - * @param expressions The expression to divide by. - * @return A new {@code Expr} representing the division operation. + * @param fieldName - The field name to be divided. + * @param expressions - The expression to divide by. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation. */ export function divide( fieldName: string, @@ -3869,14 +4026,15 @@ export function divide( * * Creates an expression that divides a field's value by a constant value. * + * @example * ```typescript * // Divide the 'value' field by 10 * divide("value", 10); * ``` * - * @param fieldName The field name to be divided. - * @param value The constant value to divide by. - * @return A new {@code Expr} representing the division operation. + * @param fieldName - The field name to be divided. + * @param value - The constant value to divide by. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the division operation. */ export function divide(fieldName: string, value: unknown): FunctionExpression; export function divide( @@ -3893,14 +4051,15 @@ export function divide( * * Creates an expression that calculates the modulo (remainder) of dividing two expressions. * + * @example * ```typescript * // Calculate the remainder of dividing 'field1' by 'field2'. * mod(field("field1"), field("field2")); * ``` * - * @param left The dividend expression. - * @param right The divisor expression. - * @return A new {@code Expr} representing the modulo operation. + * @param left - The dividend expression. + * @param right - The divisor expression. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation. */ export function mod(left: Expression, right: Expression): FunctionExpression; @@ -3909,14 +4068,15 @@ export function mod(left: Expression, right: Expression): FunctionExpression; * * Creates an expression that calculates the modulo (remainder) of dividing an expression by a constant. * + * @example * ```typescript * // Calculate the remainder of dividing 'field1' by 5. * mod(field("field1"), 5); * ``` * - * @param expression The dividend expression. - * @param value The divisor constant. - * @return A new {@code Expr} representing the modulo operation. + * @param expression - The dividend expression. + * @param value - The divisor constant. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation. */ export function mod(expression: Expression, value: unknown): FunctionExpression; @@ -3925,14 +4085,15 @@ export function mod(expression: Expression, value: unknown): FunctionExpression; * * Creates an expression that calculates the modulo (remainder) of dividing a field's value by an expression. * + * @example * ```typescript * // Calculate the remainder of dividing 'field1' by 'field2'. * mod("field1", field("field2")); * ``` * - * @param fieldName The dividend field name. - * @param expression The divisor expression. - * @return A new {@code Expr} representing the modulo operation. + * @param fieldName - The dividend field name. + * @param expression - The divisor expression. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation. */ export function mod( fieldName: string, @@ -3944,14 +4105,15 @@ export function mod( * * Creates an expression that calculates the modulo (remainder) of dividing a field's value by a constant. * + * @example * ```typescript * // Calculate the remainder of dividing 'field1' by 5. * mod("field1", 5); * ``` * - * @param fieldName The dividend field name. - * @param value The divisor constant. - * @return A new {@code Expr} representing the modulo operation. + * @param fieldName - The dividend field name. + * @param value - The divisor constant. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the modulo operation. */ export function mod(fieldName: string, value: unknown): FunctionExpression; export function mod( @@ -3968,13 +4130,14 @@ export function mod( * * Creates an expression that creates a Firestore map value from an input object. * + * @example * ```typescript * // Create a map from the input object and reference the 'baz' field value from the input document. * map({foo: 'bar', baz: Field.of('baz')}).as('data'); * ``` * - * @param elements The input map to evaluate in the expression. - * @return A new {@code Expr} representing the map function. + * @param elements - The input map to evaluate in the expression. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the map function. */ export function map(elements: Record): FunctionExpression { return _map(elements, 'map'); @@ -4021,13 +4184,14 @@ export function _mapValue(plainObject: Record): MapValue { * * Creates an expression that creates a Firestore array value from an input array. * + * @example * ```typescript * // Create an array value from the input array and reference the 'baz' field value from the input document. * array(['bar', Field.of('baz')]).as('foo'); * ``` * - * @param elements The input array to evaluate in the expression. - * @return A new {@code Expr} representing the array function. + * @param elements - The input array to evaluate in the expression. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the array function. */ export function array(elements: unknown[]): FunctionExpression { return _array(elements, 'array'); @@ -4048,14 +4212,15 @@ export function _array( * * Creates an expression that checks if two expressions are equal. * + * @example * ```typescript * // Check if the 'age' field is equal to an expression * equal(field("age"), field("minAge").add(10)); * ``` * - * @param left The first expression to compare. - * @param right The second expression to compare. - * @return A new `Expr` representing the equality comparison. + * @param left - The first expression to compare. + * @param right - The second expression to compare. + * @returns A new `Expression` representing the equality comparison. */ export function equal(left: Expression, right: Expression): BooleanExpression; @@ -4064,14 +4229,15 @@ export function equal(left: Expression, right: Expression): BooleanExpression; * * Creates an expression that checks if an expression is equal to a constant value. * + * @example * ```typescript * // Check if the 'age' field is equal to 21 * equal(field("age"), 21); * ``` * - * @param expression The expression to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the equality comparison. + * @param expression - The expression to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the equality comparison. */ export function equal( expression: Expression, @@ -4083,14 +4249,15 @@ export function equal( * * Creates an expression that checks if a field's value is equal to an expression. * + * @example * ```typescript * // Check if the 'age' field is equal to the 'limit' field * equal("age", field("limit")); * ``` * - * @param fieldName The field name to compare. - * @param expression The expression to compare to. - * @return A new `Expr` representing the equality comparison. + * @param fieldName - The field name to compare. + * @param expression - The expression to compare to. + * @returns A new `Expression` representing the equality comparison. */ export function equal( fieldName: string, @@ -4102,14 +4269,15 @@ export function equal( * * Creates an expression that checks if a field's value is equal to a constant value. * + * @example * ```typescript * // Check if the 'city' field is equal to string constant "London" * equal("city", "London"); * ``` * - * @param fieldName The field name to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the equality comparison. + * @param fieldName - The field name to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the equality comparison. */ export function equal(fieldName: string, value: unknown): BooleanExpression; export function equal( @@ -4126,14 +4294,15 @@ export function equal( * * Creates an expression that checks if two expressions are not equal. * + * @example * ```typescript * // Check if the 'status' field is not equal to field 'finalState' * notEqual(field("status"), field("finalState")); * ``` * - * @param left The first expression to compare. - * @param right The second expression to compare. - * @return A new `Expr` representing the inequality comparison. + * @param left - The first expression to compare. + * @param right - The second expression to compare. + * @returns A new `Expression` representing the inequality comparison. */ export function notEqual( left: Expression, @@ -4145,14 +4314,15 @@ export function notEqual( * * Creates an expression that checks if an expression is not equal to a constant value. * + * @example * ```typescript * // Check if the 'status' field is not equal to "completed" * notEqual(field("status"), "completed"); * ``` * - * @param expression The expression to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the inequality comparison. + * @param expression - The expression to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the inequality comparison. */ export function notEqual( expression: Expression, @@ -4164,14 +4334,15 @@ export function notEqual( * * Creates an expression that checks if a field's value is not equal to an expression. * + * @example * ```typescript * // Check if the 'status' field is not equal to the value of 'expectedStatus' * notEqual("status", field("expectedStatus")); * ``` * - * @param fieldName The field name to compare. - * @param expression The expression to compare to. - * @return A new `Expr` representing the inequality comparison. + * @param fieldName - The field name to compare. + * @param expression - The expression to compare to. + * @returns A new `Expression` representing the inequality comparison. */ export function notEqual( fieldName: string, @@ -4183,14 +4354,15 @@ export function notEqual( * * Creates an expression that checks if a field's value is not equal to a constant value. * + * @example * ```typescript * // Check if the 'country' field is not equal to "USA" * notEqual("country", "USA"); * ``` * - * @param fieldName The field name to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the inequality comparison. + * @param fieldName - The field name to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the inequality comparison. */ export function notEqual(fieldName: string, value: unknown): BooleanExpression; export function notEqual( @@ -4207,14 +4379,15 @@ export function notEqual( * * Creates an expression that checks if the first expression is less than the second expression. * + * @example * ```typescript * // Check if the 'age' field is less than 30 * lessThan(field("age"), field("limit")); * ``` * - * @param left The first expression to compare. - * @param right The second expression to compare. - * @return A new `Expr` representing the less than comparison. + * @param left - The first expression to compare. + * @param right - The second expression to compare. + * @returns A new `Expression` representing the less than comparison. */ export function lessThan( left: Expression, @@ -4226,14 +4399,15 @@ export function lessThan( * * Creates an expression that checks if an expression is less than a constant value. * + * @example * ```typescript * // Check if the 'age' field is less than 30 * lessThan(field("age"), 30); * ``` * - * @param expression The expression to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the less than comparison. + * @param expression - The expression to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the less than comparison. */ export function lessThan( expression: Expression, @@ -4245,14 +4419,15 @@ export function lessThan( * * Creates an expression that checks if a field's value is less than an expression. * + * @example * ```typescript * // Check if the 'age' field is less than the 'limit' field * lessThan("age", field("limit")); * ``` * - * @param fieldName The field name to compare. - * @param expression The expression to compare to. - * @return A new `Expr` representing the less than comparison. + * @param fieldName - The field name to compare. + * @param expression - The expression to compare to. + * @returns A new `Expression` representing the less than comparison. */ export function lessThan( fieldName: string, @@ -4264,14 +4439,15 @@ export function lessThan( * * Creates an expression that checks if a field's value is less than a constant value. * + * @example * ```typescript * // Check if the 'price' field is less than 50 * lessThan("price", 50); * ``` * - * @param fieldName The field name to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the less than comparison. + * @param fieldName - The field name to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the less than comparison. */ export function lessThan(fieldName: string, value: unknown): BooleanExpression; export function lessThan( @@ -4289,14 +4465,15 @@ export function lessThan( * Creates an expression that checks if the first expression is less than or equal to the second * expression. * + * @example * ```typescript * // Check if the 'quantity' field is less than or equal to 20 * lessThan(field("quantity"), field("limit")); * ``` * - * @param left The first expression to compare. - * @param right The second expression to compare. - * @return A new `Expr` representing the less than or equal to comparison. + * @param left - The first expression to compare. + * @param right - The second expression to compare. + * @returns A new `Expression` representing the less than or equal to comparison. */ export function lessThanOrEqual( left: Expression, @@ -4308,14 +4485,15 @@ export function lessThanOrEqual( * * Creates an expression that checks if an expression is less than or equal to a constant value. * + * @example * ```typescript * // Check if the 'quantity' field is less than or equal to 20 * lessThan(field("quantity"), 20); * ``` * - * @param expression The expression to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the less than or equal to comparison. + * @param expression - The expression to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the less than or equal to comparison. */ export function lessThanOrEqual( expression: Expression, @@ -4326,14 +4504,15 @@ export function lessThanOrEqual( * @beta * Creates an expression that checks if a field's value is less than or equal to an expression. * + * @example * ```typescript * // Check if the 'quantity' field is less than or equal to the 'limit' field * lessThan("quantity", field("limit")); * ``` * - * @param fieldName The field name to compare. - * @param expression The expression to compare to. - * @return A new `Expr` representing the less than or equal to comparison. + * @param fieldName - The field name to compare. + * @param expression - The expression to compare to. + * @returns A new `Expression` representing the less than or equal to comparison. */ export function lessThanOrEqual( fieldName: string, @@ -4345,14 +4524,15 @@ export function lessThanOrEqual( * * Creates an expression that checks if a field's value is less than or equal to a constant value. * + * @example * ```typescript * // Check if the 'score' field is less than or equal to 70 * lessThan("score", 70); * ``` * - * @param fieldName The field name to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the less than or equal to comparison. + * @param fieldName - The field name to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the less than or equal to comparison. */ export function lessThanOrEqual( fieldName: string, @@ -4373,14 +4553,15 @@ export function lessThanOrEqual( * Creates an expression that checks if the first expression is greater than the second * expression. * + * @example * ```typescript * // Check if the 'age' field is greater than 18 * greaterThan(field("age"), Constant(9).add(9)); * ``` * - * @param left The first expression to compare. - * @param right The second expression to compare. - * @return A new `Expr` representing the greater than comparison. + * @param left - The first expression to compare. + * @param right - The second expression to compare. + * @returns A new `Expression` representing the greater than comparison. */ export function greaterThan( left: Expression, @@ -4392,14 +4573,15 @@ export function greaterThan( * * Creates an expression that checks if an expression is greater than a constant value. * + * @example * ```typescript * // Check if the 'age' field is greater than 18 * greaterThan(field("age"), 18); * ``` * - * @param expression The expression to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the greater than comparison. + * @param expression - The expression to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the greater than comparison. */ export function greaterThan( expression: Expression, @@ -4411,14 +4593,15 @@ export function greaterThan( * * Creates an expression that checks if a field's value is greater than an expression. * + * @example * ```typescript * // Check if the value of field 'age' is greater than the value of field 'limit' * greaterThan("age", field("limit")); * ``` * - * @param fieldName The field name to compare. - * @param expression The expression to compare to. - * @return A new `Expr` representing the greater than comparison. + * @param fieldName - The field name to compare. + * @param expression - The expression to compare to. + * @returns A new `Expression` representing the greater than comparison. */ export function greaterThan( fieldName: string, @@ -4430,14 +4613,15 @@ export function greaterThan( * * Creates an expression that checks if a field's value is greater than a constant value. * + * @example * ```typescript * // Check if the 'price' field is greater than 100 * greaterThan("price", 100); * ``` * - * @param fieldName The field name to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the greater than comparison. + * @param fieldName - The field name to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the greater than comparison. */ export function greaterThan( fieldName: string, @@ -4458,14 +4642,15 @@ export function greaterThan( * Creates an expression that checks if the first expression is greater than or equal to the * second expression. * + * @example * ```typescript * // Check if the 'quantity' field is greater than or equal to the field "threshold" * greaterThanOrEqual(field("quantity"), field("threshold")); * ``` * - * @param left The first expression to compare. - * @param right The second expression to compare. - * @return A new `Expr` representing the greater than or equal to comparison. + * @param left - The first expression to compare. + * @param right - The second expression to compare. + * @returns A new `Expression` representing the greater than or equal to comparison. */ export function greaterThanOrEqual( left: Expression, @@ -4478,14 +4663,15 @@ export function greaterThanOrEqual( * Creates an expression that checks if an expression is greater than or equal to a constant * value. * + * @example * ```typescript * // Check if the 'quantity' field is greater than or equal to 10 * greaterThanOrEqual(field("quantity"), 10); * ``` * - * @param expression The expression to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the greater than or equal to comparison. + * @param expression - The expression to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the greater than or equal to comparison. */ export function greaterThanOrEqual( expression: Expression, @@ -4497,14 +4683,15 @@ export function greaterThanOrEqual( * * Creates an expression that checks if a field's value is greater than or equal to an expression. * + * @example * ```typescript * // Check if the value of field 'age' is greater than or equal to the value of field 'limit' * greaterThanOrEqual("age", field("limit")); * ``` * - * @param fieldName The field name to compare. - * @param value The expression to compare to. - * @return A new `Expr` representing the greater than or equal to comparison. + * @param fieldName - The field name to compare. + * @param value - The expression to compare to. + * @returns A new `Expression` representing the greater than or equal to comparison. */ export function greaterThanOrEqual( fieldName: string, @@ -4517,14 +4704,15 @@ export function greaterThanOrEqual( * Creates an expression that checks if a field's value is greater than or equal to a constant * value. * + * @example * ```typescript * // Check if the 'score' field is greater than or equal to 80 * greaterThanOrEqual("score", 80); * ``` * - * @param fieldName The field name to compare. - * @param value The constant value to compare to. - * @return A new `Expr` representing the greater than or equal to comparison. + * @param fieldName - The field name to compare. + * @param value - The constant value to compare to. + * @returns A new `Expression` representing the greater than or equal to comparison. */ export function greaterThanOrEqual( fieldName: string, @@ -4544,15 +4732,16 @@ export function greaterThanOrEqual( * * Creates an expression that concatenates an array expression with other arrays. * + * @example * ```typescript * // Combine the 'items' array with two new item arrays * arrayConcat(field("items"), [field("newItems"), field("otherItems")]); * ``` * - * @param firstArray The first array expression to concatenate to. - * @param secondArray The second array expression or array literal to concatenate to. - * @param otherArrays Optional additional array expressions or array literals to concatenate. - * @return A new {@code Expr} representing the concatenated array. + * @param firstArray - The first array expression to concatenate to. + * @param secondArray - The second array expression or array literal to concatenate to. + * @param otherArrays - Optional additional array expressions or array literals to concatenate. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated array. */ export function arrayConcat( firstArray: Expression, @@ -4565,15 +4754,16 @@ export function arrayConcat( * * Creates an expression that concatenates a field's array value with other arrays. * + * @example * ```typescript * // Combine the 'items' array with two new item arrays * arrayConcat("items", [field("newItems"), field("otherItems")]); * ``` * - * @param firstArrayField The first array to concatenate to. - * @param secondArray The second array expression or array literal to concatenate to. - * @param otherArrays Optional additional array expressions or array literals to concatenate. - * @return A new {@code Expr} representing the concatenated array. + * @param firstArrayField - The first array to concatenate to. + * @param secondArray - The second array expression or array literal to concatenate to. + * @param otherArrays - Optional additional array expressions or array literals to concatenate. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated array. */ export function arrayConcat( firstArrayField: string, @@ -4598,14 +4788,15 @@ export function arrayConcat( * * Creates an expression that checks if an array expression contains a specific element. * + * @example * ```typescript * // Check if the 'colors' array contains the value of field 'selectedColor' * arrayContains(field("colors"), field("selectedColor")); * ``` * - * @param array The array expression to check. - * @param element The element to search for in the array. - * @return A new {@code Expr} representing the 'array_contains' comparison. + * @param array - The array expression to check. + * @param element - The element to search for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison. */ export function arrayContains( array: Expression, @@ -4617,14 +4808,15 @@ export function arrayContains( * * Creates an expression that checks if an array expression contains a specific element. * + * @example * ```typescript * // Check if the 'colors' array contains "red" * arrayContains(field("colors"), "red"); * ``` * - * @param array The array expression to check. - * @param element The element to search for in the array. - * @return A new {@code Expr} representing the 'array_contains' comparison. + * @param array - The array expression to check. + * @param element - The element to search for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison. */ export function arrayContains( array: Expression, @@ -4636,14 +4828,15 @@ export function arrayContains( * * Creates an expression that checks if a field's array value contains a specific element. * + * @example * ```typescript * // Check if the 'colors' array contains the value of field 'selectedColor' * arrayContains("colors", field("selectedColor")); * ``` * - * @param fieldName The field name to check. - * @param element The element to search for in the array. - * @return A new {@code Expr} representing the 'array_contains' comparison. + * @param fieldName - The field name to check. + * @param element - The element to search for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison. */ export function arrayContains( fieldName: string, @@ -4655,14 +4848,15 @@ export function arrayContains( * * Creates an expression that checks if a field's array value contains a specific value. * + * @example * ```typescript * // Check if the 'colors' array contains "red" * arrayContains("colors", "red"); * ``` * - * @param fieldName The field name to check. - * @param element The element to search for in the array. - * @return A new {@code Expr} representing the 'array_contains' comparison. + * @param fieldName - The field name to check. + * @param element - The element to search for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains' comparison. */ export function arrayContains( fieldName: string, @@ -4683,14 +4877,15 @@ export function arrayContains( * Creates an expression that checks if an array expression contains any of the specified * elements. * + * @example * ```typescript * // Check if the 'categories' array contains either values from field "cate1" or "Science" * arrayContainsAny(field("categories"), [field("cate1"), "Science"]); * ``` * - * @param array The array expression to check. - * @param values The elements to check for in the array. - * @return A new {@code Expr} representing the 'array_contains_any' comparison. + * @param array - The array expression to check. + * @param values - The elements to check for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison. */ export function arrayContainsAny( array: Expression, @@ -4703,15 +4898,16 @@ export function arrayContainsAny( * Creates an expression that checks if a field's array value contains any of the specified * elements. * + * @example * ```typescript * // Check if the 'groups' array contains either the value from the 'userGroup' field * // or the value "guest" * arrayContainsAny("categories", [field("cate1"), "Science"]); * ``` * - * @param fieldName The field name to check. - * @param values The elements to check for in the array. - * @return A new {@code Expr} representing the 'array_contains_any' comparison. + * @param fieldName - The field name to check. + * @param values - The elements to check for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison. */ export function arrayContainsAny( fieldName: string, @@ -4724,14 +4920,15 @@ export function arrayContainsAny( * Creates an expression that checks if an array expression contains any of the specified * elements. * + * @example * ```typescript * // Check if the 'categories' array contains either values from field "cate1" or "Science" * arrayContainsAny(field("categories"), array([field("cate1"), "Science"])); * ``` * - * @param array The array expression to check. - * @param values An expression that evaluates to an array, whose elements to check for in the array. - * @return A new {@code Expr} representing the 'array_contains_any' comparison. + * @param array - The array expression to check. + * @param values - An expression that evaluates to an array, whose elements to check for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison. */ export function arrayContainsAny( array: Expression, @@ -4744,15 +4941,16 @@ export function arrayContainsAny( * Creates an expression that checks if a field's array value contains any of the specified * elements. * + * @example * ```typescript * // Check if the 'groups' array contains either the value from the 'userGroup' field * // or the value "guest" * arrayContainsAny("categories", array([field("cate1"), "Science"])); * ``` * - * @param fieldName The field name to check. - * @param values An expression that evaluates to an array, whose elements to check for in the array field. - * @return A new {@code Expr} representing the 'array_contains_any' comparison. + * @param fieldName - The field name to check. + * @param values - An expression that evaluates to an array, whose elements to check for in the array field. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_any' comparison. */ export function arrayContainsAny( fieldName: string, @@ -4771,14 +4969,15 @@ export function arrayContainsAny( * * Creates an expression that checks if an array expression contains all the specified elements. * + * @example * ```typescript * // Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" * arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); * ``` * - * @param array The array expression to check. - * @param values The elements to check for in the array. - * @return A new {@code Expr} representing the 'array_contains_all' comparison. + * @param array - The array expression to check. + * @param values - The elements to check for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison. */ export function arrayContainsAll( array: Expression, @@ -4791,14 +4990,15 @@ export function arrayContainsAll( * Creates an expression that checks if a field's array value contains all the specified values or * expressions. * + * @example * ```typescript * // Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" * arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); * ``` * - * @param fieldName The field name to check. - * @param values The elements to check for in the array. - * @return A new {@code Expr} representing the 'array_contains_all' comparison. + * @param fieldName - The field name to check. + * @param values - The elements to check for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison. */ export function arrayContainsAll( fieldName: string, @@ -4810,14 +5010,15 @@ export function arrayContainsAll( * * Creates an expression that checks if an array expression contains all the specified elements. * + * @example * ```typescript * // Check if the "tags" array contains all of the values: "SciFi", "Adventure", and the value from field "tag1" * arrayContainsAll(field("tags"), [field("tag1"), constant("SciFi"), "Adventure"]); * ``` * - * @param array The array expression to check. - * @param arrayExpression The elements to check for in the array. - * @return A new {@code Expr} representing the 'array_contains_all' comparison. + * @param array - The array expression to check. + * @param arrayExpression - The elements to check for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison. */ export function arrayContainsAll( array: Expression, @@ -4830,14 +5031,15 @@ export function arrayContainsAll( * Creates an expression that checks if a field's array value contains all the specified values or * expressions. * + * @example * ```typescript * // Check if the 'tags' array contains both of the values from field 'tag1', the value "SciFi", and "Adventure" * arrayContainsAll("tags", [field("tag1"), "SciFi", "Adventure"]); * ``` * - * @param fieldName The field name to check. - * @param arrayExpression The elements to check for in the array. - * @return A new {@code Expr} representing the 'array_contains_all' comparison. + * @param fieldName - The field name to check. + * @param arrayExpression - The elements to check for in the array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'array_contains_all' comparison. */ export function arrayContainsAll( fieldName: string, @@ -4856,13 +5058,14 @@ export function arrayContainsAll( * * Creates an expression that calculates the length of an array in a specified field. * + * @example * ```typescript * // Get the number of items in field 'cart' * arrayLength('cart'); * ``` * - * @param fieldName The name of the field containing an array to calculate the length of. - * @return A new {@code Expr} representing the length of the array. + * @param fieldName - The name of the field containing an array to calculate the length of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array. */ export function arrayLength(fieldName: string): FunctionExpression; @@ -4871,13 +5074,14 @@ export function arrayLength(fieldName: string): FunctionExpression; * * Creates an expression that calculates the length of an array expression. * + * @example * ```typescript * // Get the number of items in the 'cart' array * arrayLength(field("cart")); * ``` * - * @param array The array expression to calculate the length of. - * @return A new {@code Expr} representing the length of the array. + * @param array - The array expression to calculate the length of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array. */ export function arrayLength(array: Expression): FunctionExpression; export function arrayLength(array: Expression | string): FunctionExpression { @@ -4890,14 +5094,15 @@ export function arrayLength(array: Expression | string): FunctionExpression { * Creates an expression that checks if an expression, when evaluated, is equal to any of the provided values or * expressions. * + * @example * ```typescript * // Check if the 'category' field is either "Electronics" or value of field 'primaryType' * equalAny(field("category"), [constant("Electronics"), field("primaryType")]); * ``` * - * @param expression The expression whose results to compare. - * @param values The values to check against. - * @return A new {@code Expr} representing the 'IN' comparison. + * @param expression - The expression whose results to compare. + * @param values - The values to check against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison. */ export function equalAny( expression: Expression, @@ -4909,14 +5114,15 @@ export function equalAny( * * Creates an expression that checks if an expression is equal to any of the provided values. * + * @example * ```typescript * // Check if the 'category' field is set to a value in the disabledCategories field * equalAny(field("category"), field('disabledCategories')); * ``` * - * @param expression The expression whose results to compare. - * @param arrayExpression An expression that evaluates to an array, whose elements to check for equality to the input. - * @return A new {@code Expr} representing the 'IN' comparison. + * @param expression - The expression whose results to compare. + * @param arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison. */ export function equalAny( expression: Expression, @@ -4929,14 +5135,15 @@ export function equalAny( * Creates an expression that checks if a field's value is equal to any of the provided values or * expressions. * + * @example * ```typescript * // Check if the 'category' field is either "Electronics" or value of field 'primaryType' * equalAny("category", [constant("Electronics"), field("primaryType")]); * ``` * - * @param fieldName The field to compare. - * @param values The values to check against. - * @return A new {@code Expr} representing the 'IN' comparison. + * @param fieldName - The field to compare. + * @param values - The values to check against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison. */ export function equalAny( fieldName: string, @@ -4949,14 +5156,15 @@ export function equalAny( * Creates an expression that checks if a field's value is equal to any of the provided values or * expressions. * + * @example * ```typescript * // Check if the 'category' field is either "Electronics" or value of field 'primaryType' * equalAny("category", ["Electronics", field("primaryType")]); * ``` * - * @param fieldName The field to compare. - * @param arrayExpression An expression that evaluates to an array, whose elements to check for equality to the input field. - * @return A new {@code Expr} representing the 'IN' comparison. + * @param fieldName - The field to compare. + * @param arrayExpression - An expression that evaluates to an array, whose elements to check for equality to the input field. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'IN' comparison. */ export function equalAny( fieldName: string, @@ -4976,14 +5184,15 @@ export function equalAny( * Creates an expression that checks if an expression is not equal to any of the provided values * or expressions. * + * @example * ```typescript * // Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' * notEqualAny(field("status"), ["pending", field("rejectedStatus")]); * ``` * - * @param element The expression to compare. - * @param values The values to check against. - * @return A new {@code Expr} representing the 'NOT IN' comparison. + * @param element - The expression to compare. + * @param values - The values to check against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison. */ export function notEqualAny( element: Expression, @@ -4996,14 +5205,15 @@ export function notEqualAny( * Creates an expression that checks if a field's value is not equal to any of the provided values * or expressions. * + * @example * ```typescript * // Check if the 'status' field is neither "pending" nor the value of 'rejectedStatus' * notEqualAny("status", [constant("pending"), field("rejectedStatus")]); * ``` * - * @param fieldName The field name to compare. - * @param values The values to check against. - * @return A new {@code Expr} representing the 'NOT IN' comparison. + * @param fieldName - The field name to compare. + * @param values - The values to check against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison. */ export function notEqualAny( fieldName: string, @@ -5016,14 +5226,15 @@ export function notEqualAny( * Creates an expression that checks if an expression is not equal to any of the provided values * or expressions. * + * @example * ```typescript * // Check if the 'status' field is neither "pending" nor the value of the field 'rejectedStatus' * notEqualAny(field("status"), ["pending", field("rejectedStatus")]); * ``` * - * @param element The expression to compare. - * @param arrayExpression The values to check against. - * @return A new {@code Expr} representing the 'NOT IN' comparison. + * @param element - The expression to compare. + * @param arrayExpression - The values to check against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison. */ export function notEqualAny( element: Expression, @@ -5035,14 +5246,15 @@ export function notEqualAny( * * Creates an expression that checks if a field's value is not equal to any of the values in the evaluated expression. * + * @example * ```typescript * // Check if the 'status' field is not equal to any value in the field 'rejectedStatuses' * notEqualAny("status", field("rejectedStatuses")); * ``` * - * @param fieldName The field name to compare. - * @param arrayExpression The values to check against. - * @return A new {@code Expr} representing the 'NOT IN' comparison. + * @param fieldName - The field name to compare. + * @param arrayExpression - The values to check against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'NOT IN' comparison. */ export function notEqualAny( fieldName: string, @@ -5062,6 +5274,7 @@ export function notEqualAny( * * Creates an expression that performs a logical 'XOR' (exclusive OR) operation on multiple BooleanExpressions. * + * @example * ```typescript * // Check if only one of the conditions is true: 'age' greater than 18, 'city' is "London", * // or 'status' is "active". @@ -5071,10 +5284,10 @@ export function notEqualAny( * equal("status", "active")); * ``` * - * @param first The first condition. - * @param second The second condition. - * @param additionalConditions Additional conditions to 'XOR' together. - * @return A new {@code Expr} representing the logical 'XOR' operation. + * @param first - The first condition. + * @param second - The second condition. + * @param additionalConditions - Additional conditions to 'XOR' together. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical 'XOR' operation. */ export function xor( first: BooleanExpression, @@ -5094,16 +5307,17 @@ export function xor( * Creates a conditional expression that evaluates to a 'then' expression if a condition is true * and an 'else' expression if the condition is false. * + * @example * ```typescript * // If 'age' is greater than 18, return "Adult"; otherwise, return "Minor". * conditional( * greaterThan("age", 18), constant("Adult"), constant("Minor")); * ``` * - * @param condition The condition to evaluate. - * @param thenExpr The expression to evaluate if the condition is true. - * @param elseExpr The expression to evaluate if the condition is false. - * @return A new {@code Expr} representing the conditional expression. + * @param condition - The condition to evaluate. + * @param thenExpr - The expression to evaluate if the condition is true. + * @param elseExpr - The expression to evaluate if the condition is false. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the conditional expression. */ export function conditional( condition: BooleanExpression, @@ -5122,13 +5336,14 @@ export function conditional( * * Creates an expression that negates a filter condition. * + * @example * ```typescript * // Find documents where the 'completed' field is NOT true * not(equal("completed", true)); * ``` * - * @param booleanExpr The filter condition to negate. - * @return A new {@code Expr} representing the negated filter condition. + * @param booleanExpr - The filter condition to negate. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the negated filter condition. */ export function not(booleanExpr: BooleanExpression): BooleanExpression { return booleanExpr.not(); @@ -5140,16 +5355,17 @@ export function not(booleanExpr: BooleanExpression): BooleanExpression { * Creates an expression that returns the largest value between multiple input * expressions or literal values. Based on Firestore's value type ordering. * + * @example * ```typescript * // Returns the largest value between the 'field1' field, the 'field2' field, * // and 1000 * logicalMaximum(field("field1"), field("field2"), 1000); * ``` * - * @param first The first operand expression. - * @param second The second expression or literal. - * @param others Optional additional expressions or literals. - * @return A new {@code Expr} representing the logical maximum operation. + * @param first - The first operand expression. + * @param second - The second expression or literal. + * @param others - Optional additional expressions or literals. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical maximum operation. */ export function logicalMaximum( first: Expression, @@ -5163,16 +5379,17 @@ export function logicalMaximum( * Creates an expression that returns the largest value between multiple input * expressions or literal values. Based on Firestore's value type ordering. * + * @example * ```typescript * // Returns the largest value between the 'field1' field, the 'field2' field, * // and 1000. * logicalMaximum("field1", field("field2"), 1000); * ``` * - * @param fieldName The first operand field name. - * @param second The second expression or literal. - * @param others Optional additional expressions or literals. - * @return A new {@code Expr} representing the logical maximum operation. + * @param fieldName - The first operand field name. + * @param second - The second expression or literal. + * @param others - Optional additional expressions or literals. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical maximum operation. */ export function logicalMaximum( fieldName: string, @@ -5197,16 +5414,17 @@ export function logicalMaximum( * Creates an expression that returns the smallest value between multiple input * expressions and literal values. Based on Firestore's value type ordering. * + * @example * ```typescript * // Returns the smallest value between the 'field1' field, the 'field2' field, * // and 1000. * logicalMinimum(field("field1"), field("field2"), 1000); * ``` * - * @param first The first operand expression. - * @param second The second expression or literal. - * @param others Optional additional expressions or literals. - * @return A new {@code Expr} representing the logical minimum operation. + * @param first - The first operand expression. + * @param second - The second expression or literal. + * @param others - Optional additional expressions or literals. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical minimum operation. */ export function logicalMinimum( first: Expression, @@ -5221,16 +5439,17 @@ export function logicalMinimum( * and other input expressions or literal values. * Based on Firestore's value type ordering. * + * @example * ```typescript * // Returns the smallest value between the 'field1' field, the 'field2' field, * // and 1000. * logicalMinimum("field1", field("field2"), 1000); * ``` * - * @param fieldName The first operand field name. - * @param second The second expression or literal. - * @param others Optional additional expressions or literals. - * @return A new {@code Expr} representing the logical minimum operation. + * @param fieldName - The first operand field name. + * @param second - The second expression or literal. + * @param others - Optional additional expressions or literals. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical minimum operation. */ export function logicalMinimum( fieldName: string, @@ -5254,13 +5473,14 @@ export function logicalMinimum( * * Creates an expression that checks if a field exists. * + * @example * ```typescript * // Check if the document has a field named "phoneNumber" * exists(field("phoneNumber")); * ``` * - * @param value An expression evaluates to the name of the field to check. - * @return A new {@code Expr} representing the 'exists' check. + * @param value - An expression evaluates to the name of the field to check. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'exists' check. */ export function exists(value: Expression): BooleanExpression; @@ -5269,13 +5489,14 @@ export function exists(value: Expression): BooleanExpression; * * Creates an expression that checks if a field exists. * + * @example * ```typescript * // Check if the document has a field named "phoneNumber" * exists("phoneNumber"); * ``` * - * @param fieldName The field name to check. - * @return A new {@code Expr} representing the 'exists' check. + * @param fieldName - The field name to check. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'exists' check. */ export function exists(fieldName: string): BooleanExpression; export function exists(valueOrField: Expression | string): BooleanExpression { @@ -5287,13 +5508,14 @@ export function exists(valueOrField: Expression | string): BooleanExpression { * * Creates an expression that reverses a string. * + * @example * ```typescript * // Reverse the value of the 'myString' field. * reverse(field("myString")); * ``` * - * @param stringExpression An expression evaluating to a string value, which will be reversed. - * @return A new {@code Expr} representing the reversed string. + * @param stringExpression - An expression evaluating to a string value, which will be reversed. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string. */ export function reverse(stringExpression: Expression): FunctionExpression; @@ -5302,13 +5524,14 @@ export function reverse(stringExpression: Expression): FunctionExpression; * * Creates an expression that reverses a string value in the specified field. * + * @example * ```typescript * // Reverse the value of the 'myString' field. * reverse("myString"); * ``` * - * @param field The name of the field representing the string to reverse. - * @return A new {@code Expr} representing the reversed string. + * @param field - The name of the field representing the string to reverse. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string. */ export function reverse(field: string): FunctionExpression; export function reverse(expr: Expression | string): FunctionExpression { @@ -5320,13 +5543,14 @@ export function reverse(expr: Expression | string): FunctionExpression { * * Creates an expression that calculates the byte length of a string in UTF-8, or just the length of a Blob. * + * @example * ```typescript * // Calculate the length of the 'myString' field in bytes. * byteLength(field("myString")); * ``` * - * @param expr The expression representing the string. - * @return A new {@code Expr} representing the length of the string in bytes. + * @param expr - The expression representing the string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string in bytes. */ export function byteLength(expr: Expression): FunctionExpression; @@ -5335,13 +5559,14 @@ export function byteLength(expr: Expression): FunctionExpression; * * Creates an expression that calculates the length of a string represented by a field in UTF-8 bytes, or just the length of a Blob. * + * @example * ```typescript * // Calculate the length of the 'myString' field in bytes. * byteLength("myString"); * ``` * - * @param fieldName The name of the field containing the string. - * @return A new {@code Expr} representing the length of the string in bytes. + * @param fieldName - The name of the field containing the string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string in bytes. */ export function byteLength(fieldName: string): FunctionExpression; export function byteLength(expr: Expression | string): FunctionExpression { @@ -5353,13 +5578,14 @@ export function byteLength(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that reverses an array. * + * @example * ```typescript * // Reverse the value of the 'myArray' field. * arrayReverse("myArray"); * ``` * - * @param fieldName The name of the field to reverse. - * @return A new {@code Expr} representing the reversed array. + * @param fieldName - The name of the field to reverse. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed array. */ export function arrayReverse(fieldName: string): FunctionExpression; @@ -5367,13 +5593,14 @@ export function arrayReverse(fieldName: string): FunctionExpression; * @beta * Creates an expression that reverses an array. * + * @example * ```typescript * // Reverse the value of the 'myArray' field. * arrayReverse(field("myArray")); * ``` * - * @param arrayExpression An expression evaluating to an array value, which will be reversed. - * @return A new {@code Expr} representing the reversed array. + * @param arrayExpression - An expression evaluating to an array value, which will be reversed. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed array. */ export function arrayReverse(arrayExpression: Expression): FunctionExpression; export function arrayReverse(expr: Expression | string): FunctionExpression { @@ -5384,12 +5611,13 @@ export function arrayReverse(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that computes e to the power of the expression's result. * + * @example * ```typescript * // Compute e to the power of 2. * exp(constant(2)); * ``` * - * @return A new {@code Expr} representing the exp of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the exp of the numeric value. */ export function exp(expression: Expression): FunctionExpression; @@ -5397,12 +5625,13 @@ export function exp(expression: Expression): FunctionExpression; * @beta * Creates an expression that computes e to the power of the expression's result. * + * @example * ```typescript * // Compute e to the power of the 'value' field. * exp('value'); * ``` * - * @return A new {@code Expr} representing the exp of the numeric value. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the exp of the numeric value. */ export function exp(fieldName: string): FunctionExpression; @@ -5416,13 +5645,14 @@ export function exp( * @beta * Creates an expression that computes the ceiling of a numeric value. * + * @example * ```typescript * // Compute the ceiling of the 'price' field. * ceil("price"); * ``` * - * @param fieldName The name of the field to compute the ceiling of. - * @return A new {@code Expr} representing the ceiling of the numeric value. + * @param fieldName - The name of the field to compute the ceiling of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the ceiling of the numeric value. */ export function ceil(fieldName: string): FunctionExpression; @@ -5430,13 +5660,14 @@ export function ceil(fieldName: string): FunctionExpression; * @beta * Creates an expression that computes the ceiling of a numeric value. * + * @example * ```typescript * // Compute the ceiling of the 'price' field. * ceil(field("price")); * ``` * - * @param expression An expression evaluating to a numeric value, which the ceiling will be computed for. - * @return A new {@code Expr} representing the ceiling of the numeric value. + * @param expression - An expression evaluating to a numeric value, which the ceiling will be computed for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the ceiling of the numeric value. */ export function ceil(expression: Expression): FunctionExpression; export function ceil(expr: Expression | string): FunctionExpression { @@ -5447,8 +5678,8 @@ export function ceil(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that computes the floor of a numeric value. * - * @param expr The expression to compute the floor of. - * @return A new {@code Expr} representing the floor of the numeric value. + * @param expr - The expression to compute the floor of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the floor of the numeric value. */ export function floor(expr: Expression): FunctionExpression; @@ -5456,8 +5687,8 @@ export function floor(expr: Expression): FunctionExpression; * @beta * Creates an expression that computes the floor of a numeric value. * - * @param fieldName The name of the field to compute the floor of. - * @return A new {@code Expr} representing the floor of the numeric value. + * @param fieldName - The name of the field to compute the floor of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the floor of the numeric value. */ export function floor(fieldName: string): FunctionExpression; export function floor(expr: Expression | string): FunctionExpression { @@ -5468,8 +5699,8 @@ export function floor(expr: Expression | string): FunctionExpression { * @beta * Creates an aggregation that counts the number of distinct values of a field. * - * @param expr The expression or field to count distinct values of. - * @return A new `AggregateFunction` representing the 'count_distinct' aggregation. + * @param expr - The expression or field to count distinct values of. + * @returns A new `AggregateFunction` representing the 'count_distinct' aggregation. */ export function countDistinct(expr: Expression | string): AggregateFunction { return fieldOrExpression(expr).countDistinct(); @@ -5480,13 +5711,14 @@ export function countDistinct(expr: Expression | string): AggregateFunction { * * Creates an expression that calculates the character length of a string field in UTF8. * + * @example * ```typescript * // Get the character length of the 'name' field in UTF-8. * strLength("name"); * ``` * - * @param fieldName The name of the field containing the string. - * @return A new {@code Expr} representing the length of the string. + * @param fieldName - The name of the field containing the string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string. */ export function charLength(fieldName: string): FunctionExpression; @@ -5495,13 +5727,14 @@ export function charLength(fieldName: string): FunctionExpression; * * Creates an expression that calculates the character length of a string expression in UTF-8. * + * @example * ```typescript * // Get the character length of the 'name' field in UTF-8. * strLength(field("name")); * ``` * - * @param stringExpression The expression representing the string to calculate the length of. - * @return A new {@code Expr} representing the length of the string. + * @param stringExpression - The expression representing the string to calculate the length of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the string. */ export function charLength(stringExpression: Expression): FunctionExpression; export function charLength(value: Expression | string): FunctionExpression { @@ -5515,14 +5748,15 @@ export function charLength(value: Expression | string): FunctionExpression { * Creates an expression that performs a case-sensitive wildcard string comparison against a * field. * + * @example * ```typescript * // Check if the 'title' field contains the string "guide" * like("title", "%guide%"); * ``` * - * @param fieldName The name of the field containing the string. - * @param pattern The pattern to search for. You can use "%" as a wildcard character. - * @return A new {@code Expr} representing the 'like' comparison. + * @param fieldName - The name of the field containing the string. + * @param pattern - The pattern to search for. You can use "%" as a wildcard character. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison. */ export function like(fieldName: string, pattern: string): BooleanExpression; @@ -5532,14 +5766,15 @@ export function like(fieldName: string, pattern: string): BooleanExpression; * Creates an expression that performs a case-sensitive wildcard string comparison against a * field. * + * @example * ```typescript * // Check if the 'title' field contains the string "guide" * like("title", field("pattern")); * ``` * - * @param fieldName The name of the field containing the string. - * @param pattern The pattern to search for. You can use "%" as a wildcard character. - * @return A new {@code Expr} representing the 'like' comparison. + * @param fieldName - The name of the field containing the string. + * @param pattern - The pattern to search for. You can use "%" as a wildcard character. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison. */ export function like(fieldName: string, pattern: Expression): BooleanExpression; @@ -5548,14 +5783,15 @@ export function like(fieldName: string, pattern: Expression): BooleanExpression; * * Creates an expression that performs a case-sensitive wildcard string comparison. * + * @example * ```typescript * // Check if the 'title' field contains the string "guide" * like(field("title"), "%guide%"); * ``` * - * @param stringExpression The expression representing the string to perform the comparison on. - * @param pattern The pattern to search for. You can use "%" as a wildcard character. - * @return A new {@code Expr} representing the 'like' comparison. + * @param stringExpression - The expression representing the string to perform the comparison on. + * @param pattern - The pattern to search for. You can use "%" as a wildcard character. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison. */ export function like( stringExpression: Expression, @@ -5567,14 +5803,15 @@ export function like( * * Creates an expression that performs a case-sensitive wildcard string comparison. * + * @example * ```typescript * // Check if the 'title' field contains the string "guide" * like(field("title"), field("pattern")); * ``` * - * @param stringExpression The expression representing the string to perform the comparison on. - * @param pattern The pattern to search for. You can use "%" as a wildcard character. - * @return A new {@code Expr} representing the 'like' comparison. + * @param stringExpression - The expression representing the string to perform the comparison on. + * @param pattern - The pattern to search for. You can use "%" as a wildcard character. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'like' comparison. */ export function like( stringExpression: Expression, @@ -5595,14 +5832,15 @@ export function like( * Creates an expression that checks if a string field contains a specified regular expression as * a substring. * + * @example * ```typescript * // Check if the 'description' field contains "example" (case-insensitive) * regexContains("description", "(?i)example"); * ``` * - * @param fieldName The name of the field containing the string. - * @param pattern The regular expression to use for the search. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param fieldName - The name of the field containing the string. + * @param pattern - The regular expression to use for the search. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function regexContains( fieldName: string, @@ -5615,14 +5853,15 @@ export function regexContains( * Creates an expression that checks if a string field contains a specified regular expression as * a substring. * + * @example * ```typescript * // Check if the 'description' field contains "example" (case-insensitive) * regexContains("description", field("pattern")); * ``` * - * @param fieldName The name of the field containing the string. - * @param pattern The regular expression to use for the search. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param fieldName - The name of the field containing the string. + * @param pattern - The regular expression to use for the search. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function regexContains( fieldName: string, @@ -5635,14 +5874,15 @@ export function regexContains( * Creates an expression that checks if a string expression contains a specified regular * expression as a substring. * + * @example * ```typescript * // Check if the 'description' field contains "example" (case-insensitive) * regexContains(field("description"), "(?i)example"); * ``` * - * @param stringExpression The expression representing the string to perform the comparison on. - * @param pattern The regular expression to use for the search. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param stringExpression - The expression representing the string to perform the comparison on. + * @param pattern - The regular expression to use for the search. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function regexContains( stringExpression: Expression, @@ -5655,14 +5895,15 @@ export function regexContains( * Creates an expression that checks if a string expression contains a specified regular * expression as a substring. * + * @example * ```typescript * // Check if the 'description' field contains "example" (case-insensitive) * regexContains(field("description"), field("pattern")); * ``` * - * @param stringExpression The expression representing the string to perform the comparison on. - * @param pattern The regular expression to use for the search. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param stringExpression - The expression representing the string to perform the comparison on. + * @param pattern - The regular expression to use for the search. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function regexContains( stringExpression: Expression, @@ -5682,14 +5923,15 @@ export function regexContains( * * Creates an expression that checks if a string field matches a specified regular expression. * + * @example * ```typescript * // Check if the 'email' field matches a valid email pattern * regexMatch("email", "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); * ``` * - * @param fieldName The name of the field containing the string. - * @param pattern The regular expression to use for the match. - * @return A new {@code Expr} representing the regular expression match. + * @param fieldName - The name of the field containing the string. + * @param pattern - The regular expression to use for the match. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match. */ export function regexMatch( fieldName: string, @@ -5701,14 +5943,15 @@ export function regexMatch( * * Creates an expression that checks if a string field matches a specified regular expression. * + * @example * ```typescript * // Check if the 'email' field matches a valid email pattern * regexMatch("email", field("pattern")); * ``` * - * @param fieldName The name of the field containing the string. - * @param pattern The regular expression to use for the match. - * @return A new {@code Expr} representing the regular expression match. + * @param fieldName - The name of the field containing the string. + * @param pattern - The regular expression to use for the match. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match. */ export function regexMatch( fieldName: string, @@ -5721,14 +5964,15 @@ export function regexMatch( * Creates an expression that checks if a string expression matches a specified regular * expression. * + * @example * ```typescript * // Check if the 'email' field matches a valid email pattern * regexMatch(field("email"), "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"); * ``` * - * @param stringExpression The expression representing the string to match against. - * @param pattern The regular expression to use for the match. - * @return A new {@code Expr} representing the regular expression match. + * @param stringExpression - The expression representing the string to match against. + * @param pattern - The regular expression to use for the match. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match. */ export function regexMatch( stringExpression: Expression, @@ -5741,14 +5985,15 @@ export function regexMatch( * Creates an expression that checks if a string expression matches a specified regular * expression. * + * @example * ```typescript * // Check if the 'email' field matches a valid email pattern * regexMatch(field("email"), field("pattern")); * ``` * - * @param stringExpression The expression representing the string to match against. - * @param pattern The regular expression to use for the match. - * @return A new {@code Expr} representing the regular expression match. + * @param stringExpression - The expression representing the string to match against. + * @param pattern - The regular expression to use for the match. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the regular expression match. */ export function regexMatch( stringExpression: Expression, @@ -5768,14 +6013,15 @@ export function regexMatch( * * Creates an expression that checks if a string field contains a specified substring. * + * @example * ```typescript * // Check if the 'description' field contains "example". * stringContains("description", "example"); * ``` * - * @param fieldName The name of the field containing the string. - * @param substring The substring to search for. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param fieldName - The name of the field containing the string. + * @param substring - The substring to search for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function stringContains( fieldName: string, @@ -5787,14 +6033,15 @@ export function stringContains( * * Creates an expression that checks if a string field contains a substring specified by an expression. * + * @example * ```typescript * // Check if the 'description' field contains the value of the 'keyword' field. * stringContains("description", field("keyword")); * ``` * - * @param fieldName The name of the field containing the string. - * @param substring The expression representing the substring to search for. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param fieldName - The name of the field containing the string. + * @param substring - The expression representing the substring to search for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function stringContains( fieldName: string, @@ -5806,14 +6053,15 @@ export function stringContains( * * Creates an expression that checks if a string expression contains a specified substring. * + * @example * ```typescript * // Check if the 'description' field contains "example". * stringContains(field("description"), "example"); * ``` * - * @param stringExpression The expression representing the string to perform the comparison on. - * @param substring The substring to search for. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param stringExpression - The expression representing the string to perform the comparison on. + * @param substring - The substring to search for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function stringContains( stringExpression: Expression, @@ -5825,14 +6073,15 @@ export function stringContains( * * Creates an expression that checks if a string expression contains a substring specified by another expression. * + * @example * ```typescript * // Check if the 'description' field contains the value of the 'keyword' field. * stringContains(field("description"), field("keyword")); * ``` * - * @param stringExpression The expression representing the string to perform the comparison on. - * @param substring The expression representing the substring to search for. - * @return A new {@code Expr} representing the 'contains' comparison. + * @param stringExpression - The expression representing the string to perform the comparison on. + * @param substring - The expression representing the substring to search for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'contains' comparison. */ export function stringContains( stringExpression: Expression, @@ -5852,14 +6101,15 @@ export function stringContains( * * Creates an expression that checks if a field's value starts with a given prefix. * + * @example * ```typescript * // Check if the 'name' field starts with "Mr." * startsWith("name", "Mr."); * ``` * - * @param fieldName The field name to check. - * @param prefix The prefix to check for. - * @return A new {@code Expr} representing the 'starts with' comparison. + * @param fieldName - The field name to check. + * @param prefix - The prefix to check for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison. */ export function startsWith( fieldName: string, @@ -5871,14 +6121,15 @@ export function startsWith( * * Creates an expression that checks if a field's value starts with a given prefix. * + * @example * ```typescript * // Check if the 'fullName' field starts with the value of the 'firstName' field * startsWith("fullName", field("firstName")); * ``` * - * @param fieldName The field name to check. - * @param prefix The expression representing the prefix. - * @return A new {@code Expr} representing the 'starts with' comparison. + * @param fieldName - The field name to check. + * @param prefix - The expression representing the prefix. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison. */ export function startsWith( fieldName: string, @@ -5890,14 +6141,15 @@ export function startsWith( * * Creates an expression that checks if a string expression starts with a given prefix. * + * @example * ```typescript * // Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." * startsWith(field("fullName"), "Mr."); * ``` * - * @param stringExpression The expression to check. - * @param prefix The prefix to check for. - * @return A new {@code Expr} representing the 'starts with' comparison. + * @param stringExpression - The expression to check. + * @param prefix - The prefix to check for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison. */ export function startsWith( stringExpression: Expression, @@ -5909,14 +6161,15 @@ export function startsWith( * * Creates an expression that checks if a string expression starts with a given prefix. * + * @example * ```typescript * // Check if the result of concatenating 'firstName' and 'lastName' fields starts with "Mr." * startsWith(field("fullName"), field("prefix")); * ``` * - * @param stringExpression The expression to check. - * @param prefix The prefix to check for. - * @return A new {@code Expr} representing the 'starts with' comparison. + * @param stringExpression - The expression to check. + * @param prefix - The prefix to check for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'starts with' comparison. */ export function startsWith( stringExpression: Expression, @@ -5934,14 +6187,15 @@ export function startsWith( * * Creates an expression that checks if a field's value ends with a given postfix. * + * @example * ```typescript * // Check if the 'filename' field ends with ".txt" * endsWith("filename", ".txt"); * ``` * - * @param fieldName The field name to check. - * @param suffix The postfix to check for. - * @return A new {@code Expr} representing the 'ends with' comparison. + * @param fieldName - The field name to check. + * @param suffix - The postfix to check for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison. */ export function endsWith(fieldName: string, suffix: string): BooleanExpression; @@ -5950,14 +6204,15 @@ export function endsWith(fieldName: string, suffix: string): BooleanExpression; * * Creates an expression that checks if a field's value ends with a given postfix. * + * @example * ```typescript * // Check if the 'url' field ends with the value of the 'extension' field * endsWith("url", field("extension")); * ``` * - * @param fieldName The field name to check. - * @param suffix The expression representing the postfix. - * @return A new {@code Expr} representing the 'ends with' comparison. + * @param fieldName - The field name to check. + * @param suffix - The expression representing the postfix. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison. */ export function endsWith( fieldName: string, @@ -5969,14 +6224,15 @@ export function endsWith( * * Creates an expression that checks if a string expression ends with a given postfix. * + * @example * ```typescript * // Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." * endsWith(field("fullName"), "Jr."); * ``` * - * @param stringExpression The expression to check. - * @param suffix The postfix to check for. - * @return A new {@code Expr} representing the 'ends with' comparison. + * @param stringExpression - The expression to check. + * @param suffix - The postfix to check for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison. */ export function endsWith( stringExpression: Expression, @@ -5988,14 +6244,15 @@ export function endsWith( * * Creates an expression that checks if a string expression ends with a given postfix. * + * @example * ```typescript * // Check if the result of concatenating 'firstName' and 'lastName' fields ends with "Jr." * endsWith(field("fullName"), constant("Jr.")); * ``` * - * @param stringExpression The expression to check. - * @param suffix The postfix to check for. - * @return A new {@code Expr} representing the 'ends with' comparison. + * @param stringExpression - The expression to check. + * @param suffix - The postfix to check for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the 'ends with' comparison. */ export function endsWith( stringExpression: Expression, @@ -6013,13 +6270,14 @@ export function endsWith( * * Creates an expression that converts a string field to lowercase. * + * @example * ```typescript * // Convert the 'name' field to lowercase * toLower("name"); * ``` * - * @param fieldName The name of the field containing the string. - * @return A new {@code Expr} representing the lowercase string. + * @param fieldName - The name of the field containing the string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the lowercase string. */ export function toLower(fieldName: string): FunctionExpression; @@ -6028,13 +6286,14 @@ export function toLower(fieldName: string): FunctionExpression; * * Creates an expression that converts a string expression to lowercase. * + * @example * ```typescript * // Convert the 'name' field to lowercase * toLower(field("name")); * ``` * - * @param stringExpression The expression representing the string to convert to lowercase. - * @return A new {@code Expr} representing the lowercase string. + * @param stringExpression - The expression representing the string to convert to lowercase. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the lowercase string. */ export function toLower(stringExpression: Expression): FunctionExpression; export function toLower(expr: Expression | string): FunctionExpression { @@ -6046,13 +6305,14 @@ export function toLower(expr: Expression | string): FunctionExpression { * * Creates an expression that converts a string field to uppercase. * + * @example * ```typescript * // Convert the 'title' field to uppercase * toUpper("title"); * ``` * - * @param fieldName The name of the field containing the string. - * @return A new {@code Expr} representing the uppercase string. + * @param fieldName - The name of the field containing the string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the uppercase string. */ export function toUpper(fieldName: string): FunctionExpression; @@ -6061,13 +6321,14 @@ export function toUpper(fieldName: string): FunctionExpression; * * Creates an expression that converts a string expression to uppercase. * + * @example * ```typescript * // Convert the 'title' field to uppercase * toUppercase(field("title")); * ``` * - * @param stringExpression The expression representing the string to convert to uppercase. - * @return A new {@code Expr} representing the uppercase string. + * @param stringExpression - The expression representing the string to convert to uppercase. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the uppercase string. */ export function toUpper(stringExpression: Expression): FunctionExpression; export function toUpper(expr: Expression | string): FunctionExpression { @@ -6079,6 +6340,7 @@ export function toUpper(expr: Expression | string): FunctionExpression { * * Creates an expression that removes leading and trailing whitespace from a string or byte array. * + * @example * ```typescript * // Trim whitespace from the 'userInput' field * trim("userInput"); @@ -6087,10 +6349,10 @@ export function toUpper(expr: Expression | string): FunctionExpression { * trim("userInput", '"'); * ``` * - * @param fieldName The name of the field containing the string or byte array. - * @param valueToTrim Optional This parameter is treated as a set of characters or bytes that will be + * @param fieldName - The name of the field containing the string or byte array. + * @param valueToTrim - Optional This parameter is treated as a set of characters or bytes that will be * trimmed from the input. If not specified, then whitespace will be trimmed. - * @return A new {@code Expr} representing the trimmed string. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string. */ export function trim( fieldName: string, @@ -6102,6 +6364,7 @@ export function trim( * * Creates an expression that removes leading and trailing characters from a string or byte array expression. * + * @example * ```typescript * // Trim whitespace from the 'userInput' field * trim(field("userInput")); @@ -6110,10 +6373,10 @@ export function trim( * trim(field("userInput"), '"'); * ``` * - * @param stringExpression The expression representing the string or byte array to trim. - * @param valueToTrim Optional This parameter is treated as a set of characters or bytes that will be + * @param stringExpression - The expression representing the string or byte array to trim. + * @param valueToTrim - Optional This parameter is treated as a set of characters or bytes that will be * trimmed from the input. If not specified, then whitespace will be trimmed. - * @return A new {@code Expr} representing the trimmed string or byte array. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the trimmed string or byte array. */ export function trim( stringExpression: Expression, @@ -6131,15 +6394,16 @@ export function trim( * * Creates an expression that concatenates string functions, fields or constants together. * + * @example * ```typescript * // Combine the 'firstName', " ", and 'lastName' fields into a single string * stringConcat("firstName", " ", field("lastName")); * ``` * - * @param fieldName The field name containing the initial string value. - * @param secondString An expression or string literal to concatenate. - * @param otherStrings Optional additional expressions or literals (typically strings) to concatenate. - * @return A new {@code Expr} representing the concatenated string. + * @param fieldName - The field name containing the initial string value. + * @param secondString - An expression or string literal to concatenate. + * @param otherStrings - Optional additional expressions or literals (typically strings) to concatenate. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated string. */ export function stringConcat( fieldName: string, @@ -6151,15 +6415,16 @@ export function stringConcat( * @beta * Creates an expression that concatenates string expressions together. * + * @example * ```typescript * // Combine the 'firstName', " ", and 'lastName' fields into a single string * stringConcat(field("firstName"), " ", field("lastName")); * ``` * - * @param firstString The initial string expression to concatenate to. - * @param secondString An expression or string literal to concatenate. - * @param otherStrings Optional additional expressions or literals (typically strings) to concatenate. - * @return A new {@code Expr} representing the concatenated string. + * @param firstString - The initial string expression to concatenate to. + * @param secondString - An expression or string literal to concatenate. + * @param otherStrings - Optional additional expressions or literals (typically strings) to concatenate. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the concatenated string. */ export function stringConcat( firstString: Expression, @@ -6182,14 +6447,15 @@ export function stringConcat( * * Accesses a value from a map (object) field using the provided key. * + * @example * ```typescript * // Get the 'city' value from the 'address' map field * mapGet("address", "city"); * ``` * - * @param fieldName The field name of the map field. - * @param subField The key to access in the map. - * @return A new {@code Expr} representing the value associated with the given key in the map. + * @param fieldName - The field name of the map field. + * @param subField - The key to access in the map. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the value associated with the given key in the map. */ export function mapGet(fieldName: string, subField: string): FunctionExpression; @@ -6198,14 +6464,15 @@ export function mapGet(fieldName: string, subField: string): FunctionExpression; * * Accesses a value from a map (object) expression using the provided key. * + * @example * ```typescript * // Get the 'city' value from the 'address' map field * mapGet(field("address"), "city"); * ``` * - * @param mapExpression The expression representing the map. - * @param subField The key to access in the map. - * @return A new {@code Expr} representing the value associated with the given key in the map. + * @param mapExpression - The expression representing the map. + * @param subField - The key to access in the map. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the value associated with the given key in the map. */ export function mapGet( mapExpression: Expression, @@ -6223,12 +6490,13 @@ export function mapGet( * * Creates an aggregation that counts the total number of stage inputs. * + * @example * ```typescript * // Count the total number of input documents * countAll().as("totalDocument"); * ``` * - * @return A new {@code AggregateFunction} representing the 'countAll' aggregation. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'countAll' aggregation. */ export function countAll(): AggregateFunction { return AggregateFunction._create('count', [], 'count'); @@ -6240,13 +6508,14 @@ export function countAll(): AggregateFunction { * Creates an aggregation that counts the number of stage inputs with valid evaluations of the * provided expression. * + * @example * ```typescript * // Count the number of items where the price is greater than 10 * count(field("price").greaterThan(10)).as("expensiveItemCount"); * ``` * - * @param expression The expression to count. - * @return A new {@code AggregateFunction} representing the 'count' aggregation. + * @param expression - The expression to count. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'count' aggregation. */ export function count(expression: Expression): AggregateFunction; @@ -6254,13 +6523,14 @@ export function count(expression: Expression): AggregateFunction; * @beta * Creates an aggregation that counts the number of stage inputs where the input field exists. * + * @example * ```typescript * // Count the total number of products * count("productId").as("totalProducts"); * ``` * - * @param fieldName The name of the field to count. - * @return A new {@code AggregateFunction} representing the 'count' aggregation. + * @param fieldName - The name of the field to count. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'count' aggregation. */ export function count(fieldName: string): AggregateFunction; export function count(value: Expression | string): AggregateFunction { @@ -6273,13 +6543,14 @@ export function count(value: Expression | string): AggregateFunction { * Creates an aggregation that calculates the sum of values from an expression across multiple * stage inputs. * + * @example * ```typescript * // Calculate the total revenue from a set of orders * sum(field("orderAmount")).as("totalRevenue"); * ``` * - * @param expression The expression to sum up. - * @return A new {@code AggregateFunction} representing the 'sum' aggregation. + * @param expression - The expression to sum up. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'sum' aggregation. */ export function sum(expression: Expression): AggregateFunction; @@ -6289,13 +6560,14 @@ export function sum(expression: Expression): AggregateFunction; * Creates an aggregation that calculates the sum of a field's values across multiple stage * inputs. * + * @example * ```typescript * // Calculate the total revenue from a set of orders * sum("orderAmount").as("totalRevenue"); * ``` * - * @param fieldName The name of the field containing numeric values to sum up. - * @return A new {@code AggregateFunction} representing the 'sum' aggregation. + * @param fieldName - The name of the field containing numeric values to sum up. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'sum' aggregation. */ export function sum(fieldName: string): AggregateFunction; export function sum(value: Expression | string): AggregateFunction { @@ -6308,13 +6580,14 @@ export function sum(value: Expression | string): AggregateFunction { * Creates an aggregation that calculates the average (mean) of values from an expression across * multiple stage inputs. * + * @example * ```typescript * // Calculate the average age of users * average(field("age")).as("averageAge"); * ``` * - * @param expression The expression representing the values to average. - * @return A new {@code AggregateFunction} representing the 'average' aggregation. + * @param expression - The expression representing the values to average. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'average' aggregation. */ export function average(expression: Expression): AggregateFunction; @@ -6324,13 +6597,14 @@ export function average(expression: Expression): AggregateFunction; * Creates an aggregation that calculates the average (mean) of a field's values across multiple * stage inputs. * + * @example * ```typescript * // Calculate the average age of users * average("age").as("averageAge"); * ``` * - * @param fieldName The name of the field containing numeric values to average. - * @return A new {@code AggregateFunction} representing the 'average' aggregation. + * @param fieldName - The name of the field containing numeric values to average. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'average' aggregation. */ export function average(fieldName: string): AggregateFunction; export function average(value: Expression | string): AggregateFunction { @@ -6343,13 +6617,14 @@ export function average(value: Expression | string): AggregateFunction { * Creates an aggregation that finds the minimum value of an expression across multiple stage * inputs. * + * @example * ```typescript * // Find the lowest price of all products * minimum(field("price")).as("lowestPrice"); * ``` * - * @param expression The expression to find the minimum value of. - * @return A new {@code AggregateFunction} representing the 'minimum' aggregation. + * @param expression - The expression to find the minimum value of. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'minimum' aggregation. */ export function minimum(expression: Expression): AggregateFunction; @@ -6358,13 +6633,14 @@ export function minimum(expression: Expression): AggregateFunction; * * Creates an aggregation that finds the minimum value of a field across multiple stage inputs. * + * @example * ```typescript * // Find the lowest price of all products * minimum("price").as("lowestPrice"); * ``` * - * @param fieldName The name of the field to find the minimum value of. - * @return A new {@code AggregateFunction} representing the 'minimum' aggregation. + * @param fieldName - The name of the field to find the minimum value of. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'minimum' aggregation. */ export function minimum(fieldName: string): AggregateFunction; export function minimum(value: Expression | string): AggregateFunction { @@ -6377,13 +6653,14 @@ export function minimum(value: Expression | string): AggregateFunction { * Creates an aggregation that finds the maximum value of an expression across multiple stage * inputs. * + * @example * ```typescript * // Find the highest score in a leaderboard * maximum(field("score")).as("highestScore"); * ``` * - * @param expression The expression to find the maximum value of. - * @return A new {@code AggregateFunction} representing the 'maximum' aggregation. + * @param expression - The expression to find the maximum value of. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'maximum' aggregation. */ export function maximum(expression: Expression): AggregateFunction; @@ -6392,13 +6669,14 @@ export function maximum(expression: Expression): AggregateFunction; * * Creates an aggregation that finds the maximum value of a field across multiple stage inputs. * + * @example * ```typescript * // Find the highest score in a leaderboard * maximum("score").as("highestScore"); * ``` * - * @param fieldName The name of the field to find the maximum value of. - * @return A new {@code AggregateFunction} representing the 'maximum' aggregation. + * @param fieldName - The name of the field to find the maximum value of. + * @returns A new {@link @firebase/firestore/pipelines#AggregateFunction} representing the 'maximum' aggregation. */ export function maximum(fieldName: string): AggregateFunction; export function maximum(value: Expression | string): AggregateFunction { @@ -6410,14 +6688,15 @@ export function maximum(value: Expression | string): AggregateFunction { * * Calculates the Cosine distance between a field's vector value and a literal vector value. * + * @example * ```typescript * // Calculate the Cosine distance between the 'location' field and a target location * cosineDistance("location", [37.7749, -122.4194]); * ``` * - * @param fieldName The name of the field containing the first vector. - * @param vector The other vector (as an array of doubles) or {@link VectorValue} to compare against. - * @return A new {@code Expr} representing the Cosine distance between the two vectors. + * @param fieldName - The name of the field containing the first vector. + * @param vector - The other vector (as an array of doubles) or {@link VectorValue} to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Cosine distance between the two vectors. */ export function cosineDistance( fieldName: string, @@ -6429,14 +6708,15 @@ export function cosineDistance( * * Calculates the Cosine distance between a field's vector value and a vector expression. * + * @example * ```typescript * // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field * cosineDistance("userVector", field("itemVector")); * ``` * - * @param fieldName The name of the field containing the first vector. - * @param vectorExpression The other vector (represented as an Expr) to compare against. - * @return A new {@code Expr} representing the cosine distance between the two vectors. + * @param fieldName - The name of the field containing the first vector. + * @param vectorExpression - The other vector (represented as an `Expression`) to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the cosine distance between the two vectors. */ export function cosineDistance( fieldName: string, @@ -6448,14 +6728,15 @@ export function cosineDistance( * * Calculates the Cosine distance between a vector expression and a vector literal. * + * @example * ```typescript * // Calculate the cosine distance between the 'location' field and a target location * cosineDistance(field("location"), [37.7749, -122.4194]); * ``` * - * @param vectorExpression The first vector (represented as an Expr) to compare against. - * @param vector The other vector (as an array of doubles or VectorValue) to compare against. - * @return A new {@code Expr} representing the cosine distance between the two vectors. + * @param vectorExpression - The first vector (represented as an `Expression`) to compare against. + * @param vector - The other vector (as an array of doubles or VectorValue) to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the cosine distance between the two vectors. */ export function cosineDistance( vectorExpression: Expression, @@ -6467,14 +6748,15 @@ export function cosineDistance( * * Calculates the Cosine distance between two vector expressions. * + * @example * ```typescript * // Calculate the cosine distance between the 'userVector' field and the 'itemVector' field * cosineDistance(field("userVector"), field("itemVector")); * ``` * - * @param vectorExpression The first vector (represented as an Expr) to compare against. - * @param otherVectorExpression The other vector (represented as an Expr) to compare against. - * @return A new {@code Expr} representing the cosine distance between the two vectors. + * @param vectorExpression - The first vector (represented as an `Expression`) to compare against. + * @param otherVectorExpression - The other vector (represented as an `Expression`) to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the cosine distance between the two vectors. */ export function cosineDistance( vectorExpression: Expression, @@ -6494,14 +6776,15 @@ export function cosineDistance( * * Calculates the dot product between a field's vector value and a double array. * + * @example * ```typescript * // Calculate the dot product distance between a feature vector and a target vector * dotProduct("features", [0.5, 0.8, 0.2]); * ``` * - * @param fieldName The name of the field containing the first vector. - * @param vector The other vector (as an array of doubles or VectorValue) to calculate with. - * @return A new {@code Expr} representing the dot product between the two vectors. + * @param fieldName - The name of the field containing the first vector. + * @param vector - The other vector (as an array of doubles or VectorValue) to calculate with. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors. */ export function dotProduct( fieldName: string, @@ -6513,14 +6796,15 @@ export function dotProduct( * * Calculates the dot product between a field's vector value and a vector expression. * + * @example * ```typescript * // Calculate the dot product distance between two document vectors: 'docVector1' and 'docVector2' * dotProduct("docVector1", field("docVector2")); * ``` * - * @param fieldName The name of the field containing the first vector. - * @param vectorExpression The other vector (represented as an Expr) to calculate with. - * @return A new {@code Expr} representing the dot product between the two vectors. + * @param fieldName - The name of the field containing the first vector. + * @param vectorExpression - The other vector (represented as an `Expression`) to calculate with. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors. */ export function dotProduct( fieldName: string, @@ -6532,14 +6816,15 @@ export function dotProduct( * * Calculates the dot product between a vector expression and a double array. * + * @example * ```typescript * // Calculate the dot product between a feature vector and a target vector * dotProduct(field("features"), [0.5, 0.8, 0.2]); * ``` * - * @param vectorExpression The first vector (represented as an Expr) to calculate with. - * @param vector The other vector (as an array of doubles or VectorValue) to calculate with. - * @return A new {@code Expr} representing the dot product between the two vectors. + * @param vectorExpression - The first vector (represented as an `Expression`) to calculate with. + * @param vector - The other vector (as an array of doubles or VectorValue) to calculate with. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors. */ export function dotProduct( vectorExpression: Expression, @@ -6551,14 +6836,15 @@ export function dotProduct( * * Calculates the dot product between two vector expressions. * + * @example * ```typescript * // Calculate the dot product between two document vectors: 'docVector1' and 'docVector2' * dotProduct(field("docVector1"), field("docVector2")); * ``` * - * @param vectorExpression The first vector (represented as an Expr) to calculate with. - * @param otherVectorExpression The other vector (represented as an Expr) to calculate with. - * @return A new {@code Expr} representing the dot product between the two vectors. + * @param vectorExpression - The first vector (represented as an `Expression`) to calculate with. + * @param otherVectorExpression - The other vector (represented as an `Expression`) to calculate with. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the dot product between the two vectors. */ export function dotProduct( vectorExpression: Expression, @@ -6578,14 +6864,15 @@ export function dotProduct( * * Calculates the Euclidean distance between a field's vector value and a double array. * + * @example * ```typescript * // Calculate the Euclidean distance between the 'location' field and a target location * euclideanDistance("location", [37.7749, -122.4194]); * ``` * - * @param fieldName The name of the field containing the first vector. - * @param vector The other vector (as an array of doubles or VectorValue) to compare against. - * @return A new {@code Expr} representing the Euclidean distance between the two vectors. + * @param fieldName - The name of the field containing the first vector. + * @param vector - The other vector (as an array of doubles or VectorValue) to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors. */ export function euclideanDistance( fieldName: string, @@ -6597,14 +6884,15 @@ export function euclideanDistance( * * Calculates the Euclidean distance between a field's vector value and a vector expression. * + * @example * ```typescript * // Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' * euclideanDistance("pointA", field("pointB")); * ``` * - * @param fieldName The name of the field containing the first vector. - * @param vectorExpression The other vector (represented as an Expr) to compare against. - * @return A new {@code Expr} representing the Euclidean distance between the two vectors. + * @param fieldName - The name of the field containing the first vector. + * @param vectorExpression - The other vector (represented as an `Expression`) to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors. */ export function euclideanDistance( fieldName: string, @@ -6616,15 +6904,16 @@ export function euclideanDistance( * * Calculates the Euclidean distance between a vector expression and a double array. * + * @example * ```typescript * // Calculate the Euclidean distance between the 'location' field and a target location * * euclideanDistance(field("location"), [37.7749, -122.4194]); * ``` * - * @param vectorExpression The first vector (represented as an Expr) to compare against. - * @param vector The other vector (as an array of doubles or VectorValue) to compare against. - * @return A new {@code Expr} representing the Euclidean distance between the two vectors. + * @param vectorExpression - The first vector (represented as an `Expression`) to compare against. + * @param vector - The other vector (as an array of doubles or VectorValue) to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors. */ export function euclideanDistance( vectorExpression: Expression, @@ -6636,14 +6925,15 @@ export function euclideanDistance( * * Calculates the Euclidean distance between two vector expressions. * + * @example * ```typescript * // Calculate the Euclidean distance between two vector fields: 'pointA' and 'pointB' * euclideanDistance(field("pointA"), field("pointB")); * ``` * - * @param vectorExpression The first vector (represented as an Expr) to compare against. - * @param otherVectorExpression The other vector (represented as an Expr) to compare against. - * @return A new {@code Expr} representing the Euclidean distance between the two vectors. + * @param vectorExpression - The first vector (represented as an `Expression`) to compare against. + * @param otherVectorExpression - The other vector (represented as an `Expression`) to compare against. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the Euclidean distance between the two vectors. */ export function euclideanDistance( vectorExpression: Expression, @@ -6663,13 +6953,14 @@ export function euclideanDistance( * * Creates an expression that calculates the length of a Firestore Vector. * + * @example * ```typescript * // Get the vector length (dimension) of the field 'embedding'. * vectorLength(field("embedding")); * ``` * - * @param vectorExpression The expression representing the Firestore Vector. - * @return A new {@code Expr} representing the length of the array. + * @param vectorExpression - The expression representing the Firestore Vector. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array. */ export function vectorLength(vectorExpression: Expression): FunctionExpression; @@ -6678,13 +6969,14 @@ export function vectorLength(vectorExpression: Expression): FunctionExpression; * * Creates an expression that calculates the length of a Firestore Vector represented by a field. * + * @example * ```typescript * // Get the vector length (dimension) of the field 'embedding'. * vectorLength("embedding"); * ``` * - * @param fieldName The name of the field representing the Firestore Vector. - * @return A new {@code Expr} representing the length of the array. + * @param fieldName - The name of the field representing the Firestore Vector. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the length of the array. */ export function vectorLength(fieldName: string): FunctionExpression; export function vectorLength(expr: Expression | string): FunctionExpression { @@ -6697,13 +6989,14 @@ export function vectorLength(expr: Expression | string): FunctionExpression { * Creates an expression that interprets an expression as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'microseconds' field as microseconds since epoch. * unixMicrosToTimestamp(field("microseconds")); * ``` * - * @param expr The expression representing the number of microseconds since epoch. - * @return A new {@code Expr} representing the timestamp. + * @param expr - The expression representing the number of microseconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ export function unixMicrosToTimestamp(expr: Expression): FunctionExpression; @@ -6713,13 +7006,14 @@ export function unixMicrosToTimestamp(expr: Expression): FunctionExpression; * Creates an expression that interprets a field's value as the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'microseconds' field as microseconds since epoch. * unixMicrosToTimestamp("microseconds"); * ``` * - * @param fieldName The name of the field representing the number of microseconds since epoch. - * @return A new {@code Expr} representing the timestamp. + * @param fieldName - The name of the field representing the number of microseconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ export function unixMicrosToTimestamp(fieldName: string): FunctionExpression; export function unixMicrosToTimestamp( @@ -6733,13 +7027,14 @@ export function unixMicrosToTimestamp( * * Creates an expression that converts a timestamp expression to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to microseconds since epoch. * timestampToUnixMicros(field("timestamp")); * ``` * - * @param expr The expression representing the timestamp. - * @return A new {@code Expr} representing the number of microseconds since epoch. + * @param expr - The expression representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of microseconds since epoch. */ export function timestampToUnixMicros(expr: Expression): FunctionExpression; @@ -6748,13 +7043,14 @@ export function timestampToUnixMicros(expr: Expression): FunctionExpression; * * Creates an expression that converts a timestamp field to the number of microseconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to microseconds since epoch. * timestampToUnixMicros("timestamp"); * ``` * - * @param fieldName The name of the field representing the timestamp. - * @return A new {@code Expr} representing the number of microseconds since epoch. + * @param fieldName - The name of the field representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of microseconds since epoch. */ export function timestampToUnixMicros(fieldName: string): FunctionExpression; export function timestampToUnixMicros( @@ -6769,13 +7065,14 @@ export function timestampToUnixMicros( * Creates an expression that interprets an expression as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'milliseconds' field as milliseconds since epoch. * unixMillisToTimestamp(field("milliseconds")); * ``` * - * @param expr The expression representing the number of milliseconds since epoch. - * @return A new {@code Expr} representing the timestamp. + * @param expr - The expression representing the number of milliseconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ export function unixMillisToTimestamp(expr: Expression): FunctionExpression; @@ -6785,13 +7082,14 @@ export function unixMillisToTimestamp(expr: Expression): FunctionExpression; * Creates an expression that interprets a field's value as the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'milliseconds' field as milliseconds since epoch. * unixMillisToTimestamp("milliseconds"); * ``` * - * @param fieldName The name of the field representing the number of milliseconds since epoch. - * @return A new {@code Expr} representing the timestamp. + * @param fieldName - The name of the field representing the number of milliseconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ export function unixMillisToTimestamp(fieldName: string): FunctionExpression; export function unixMillisToTimestamp( @@ -6806,13 +7104,14 @@ export function unixMillisToTimestamp( * * Creates an expression that converts a timestamp expression to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to milliseconds since epoch. * timestampToUnixMillis(field("timestamp")); * ``` * - * @param expr The expression representing the timestamp. - * @return A new {@code Expr} representing the number of milliseconds since epoch. + * @param expr - The expression representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of milliseconds since epoch. */ export function timestampToUnixMillis(expr: Expression): FunctionExpression; @@ -6821,13 +7120,14 @@ export function timestampToUnixMillis(expr: Expression): FunctionExpression; * * Creates an expression that converts a timestamp field to the number of milliseconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to milliseconds since epoch. * timestampToUnixMillis("timestamp"); * ``` * - * @param fieldName The name of the field representing the timestamp. - * @return A new {@code Expr} representing the number of milliseconds since epoch. + * @param fieldName - The name of the field representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of milliseconds since epoch. */ export function timestampToUnixMillis(fieldName: string): FunctionExpression; export function timestampToUnixMillis( @@ -6843,13 +7143,14 @@ export function timestampToUnixMillis( * Creates an expression that interprets an expression as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'seconds' field as seconds since epoch. * unixSecondsToTimestamp(field("seconds")); * ``` * - * @param expr The expression representing the number of seconds since epoch. - * @return A new {@code Expr} representing the timestamp. + * @param expr - The expression representing the number of seconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ export function unixSecondsToTimestamp(expr: Expression): FunctionExpression; @@ -6859,13 +7160,14 @@ export function unixSecondsToTimestamp(expr: Expression): FunctionExpression; * Creates an expression that interprets a field's value as the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC) * and returns a timestamp. * + * @example * ```typescript * // Interpret the 'seconds' field as seconds since epoch. * unixSecondsToTimestamp("seconds"); * ``` * - * @param fieldName The name of the field representing the number of seconds since epoch. - * @return A new {@code Expr} representing the timestamp. + * @param fieldName - The name of the field representing the number of seconds since epoch. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the timestamp. */ export function unixSecondsToTimestamp(fieldName: string): FunctionExpression; export function unixSecondsToTimestamp( @@ -6880,13 +7182,14 @@ export function unixSecondsToTimestamp( * * Creates an expression that converts a timestamp expression to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to seconds since epoch. * timestampToUnixSeconds(field("timestamp")); * ``` * - * @param expr The expression representing the timestamp. - * @return A new {@code Expr} representing the number of seconds since epoch. + * @param expr - The expression representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of seconds since epoch. */ export function timestampToUnixSeconds(expr: Expression): FunctionExpression; @@ -6895,13 +7198,14 @@ export function timestampToUnixSeconds(expr: Expression): FunctionExpression; * * Creates an expression that converts a timestamp field to the number of seconds since the Unix epoch (1970-01-01 00:00:00 UTC). * + * @example * ```typescript * // Convert the 'timestamp' field to seconds since epoch. * timestampToUnixSeconds("timestamp"); * ``` * - * @param fieldName The name of the field representing the timestamp. - * @return A new {@code Expr} representing the number of seconds since epoch. + * @param fieldName - The name of the field representing the timestamp. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the number of seconds since epoch. */ export function timestampToUnixSeconds(fieldName: string): FunctionExpression; export function timestampToUnixSeconds( @@ -6916,15 +7220,16 @@ export function timestampToUnixSeconds( * * Creates an expression that adds a specified amount of time to a timestamp. * + * @example * ```typescript * // Add some duration determined by field 'unit' and 'amount' to the 'timestamp' field. * timestampAdd(field("timestamp"), field("unit"), field("amount")); * ``` * - * @param timestamp The expression representing the timestamp. - * @param unit The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. - * @param amount The expression evaluates to amount of the unit. - * @return A new {@code Expr} representing the resulting timestamp. + * @param timestamp - The expression representing the timestamp. + * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. + * @param amount - The expression evaluates to amount of the unit. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ export function timestampAdd( timestamp: Expression, @@ -6937,15 +7242,16 @@ export function timestampAdd( * * Creates an expression that adds a specified amount of time to a timestamp. * + * @example * ```typescript * // Add 1 day to the 'timestamp' field. * timestampAdd(field("timestamp"), "day", 1); * ``` * - * @param timestamp The expression representing the timestamp. - * @param unit The unit of time to add (e.g., "day", "hour"). - * @param amount The amount of time to add. - * @return A new {@code Expr} representing the resulting timestamp. + * @param timestamp - The expression representing the timestamp. + * @param unit - The unit of time to add (e.g., "day", "hour"). + * @param amount - The amount of time to add. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ export function timestampAdd( timestamp: Expression, @@ -6958,15 +7264,16 @@ export function timestampAdd( * * Creates an expression that adds a specified amount of time to a timestamp represented by a field. * + * @example * ```typescript * // Add 1 day to the 'timestamp' field. * timestampAdd("timestamp", "day", 1); * ``` * - * @param fieldName The name of the field representing the timestamp. - * @param unit The unit of time to add (e.g., "day", "hour"). - * @param amount The amount of time to add. - * @return A new {@code Expr} representing the resulting timestamp. + * @param fieldName - The name of the field representing the timestamp. + * @param unit - The unit of time to add (e.g., "day", "hour"). + * @param amount - The amount of time to add. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ export function timestampAdd( fieldName: string, @@ -6996,15 +7303,16 @@ export function timestampAdd( * * Creates an expression that subtracts a specified amount of time from a timestamp. * + * @example * ```typescript * // Subtract some duration determined by field 'unit' and 'amount' from the 'timestamp' field. * timestampSubtract(field("timestamp"), field("unit"), field("amount")); * ``` * - * @param timestamp The expression representing the timestamp. - * @param unit The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. - * @param amount The expression evaluates to amount of the unit. - * @return A new {@code Expr} representing the resulting timestamp. + * @param timestamp - The expression representing the timestamp. + * @param unit - The expression evaluates to unit of time, must be one of 'microsecond', 'millisecond', 'second', 'minute', 'hour', 'day'. + * @param amount - The expression evaluates to amount of the unit. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ export function timestampSubtract( timestamp: Expression, @@ -7017,15 +7325,16 @@ export function timestampSubtract( * * Creates an expression that subtracts a specified amount of time from a timestamp. * + * @example * ```typescript * // Subtract 1 day from the 'timestamp' field. * timestampSubtract(field("timestamp"), "day", 1); * ``` * - * @param timestamp The expression representing the timestamp. - * @param unit The unit of time to subtract (e.g., "day", "hour"). - * @param amount The amount of time to subtract. - * @return A new {@code Expr} representing the resulting timestamp. + * @param timestamp - The expression representing the timestamp. + * @param unit - The unit of time to subtract (e.g., "day", "hour"). + * @param amount - The amount of time to subtract. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ export function timestampSubtract( timestamp: Expression, @@ -7038,15 +7347,16 @@ export function timestampSubtract( * * Creates an expression that subtracts a specified amount of time from a timestamp represented by a field. * + * @example * ```typescript * // Subtract 1 day from the 'timestamp' field. * timestampSubtract("timestamp", "day", 1); * ``` * - * @param fieldName The name of the field representing the timestamp. - * @param unit The unit of time to subtract (e.g., "day", "hour"). - * @param amount The amount of time to subtract. - * @return A new {@code Expr} representing the resulting timestamp. + * @param fieldName - The name of the field representing the timestamp. + * @param unit - The unit of time to subtract (e.g., "day", "hour"). + * @param amount - The amount of time to subtract. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the resulting timestamp. */ export function timestampSubtract( fieldName: string, @@ -7079,12 +7389,13 @@ export function timestampSubtract( * * Creates an expression that evaluates to the current server timestamp. * + * @example * ```typescript * // Get the current server timestamp * currentTimestamp() * ``` * - * @return A new Expression representing the current server timestamp. + * @returns A new Expression representing the current server timestamp. */ export function currentTimestamp(): FunctionExpression { return new FunctionExpression('current_timestamp', [], 'currentTimestamp'); @@ -7095,16 +7406,17 @@ export function currentTimestamp(): FunctionExpression { * * Creates an expression that performs a logical 'AND' operation on multiple filter conditions. * + * @example * ```typescript * // Check if the 'age' field is greater than 18 AND the 'city' field is "London" AND * // the 'status' field is "active" * const condition = and(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); * ``` * - * @param first The first filter condition. - * @param second The second filter condition. - * @param more Additional filter conditions to 'AND' together. - * @return A new {@code Expr} representing the logical 'AND' operation. + * @param first - The first filter condition. + * @param second - The second filter condition. + * @param more - Additional filter conditions to 'AND' together. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical 'AND' operation. */ export function and( first: BooleanExpression, @@ -7123,16 +7435,17 @@ export function and( * * Creates an expression that performs a logical 'OR' operation on multiple filter conditions. * + * @example * ```typescript * // Check if the 'age' field is greater than 18 OR the 'city' field is "London" OR * // the 'status' field is "active" * const condition = or(greaterThan("age", 18), equal("city", "London"), equal("status", "active")); * ``` * - * @param first The first filter condition. - * @param second The second filter condition. - * @param more Additional filter conditions to 'OR' together. - * @return A new {@code Expr} representing the logical 'OR' operation. + * @param first - The first filter condition. + * @param second - The second filter condition. + * @param more - Additional filter conditions to 'OR' together. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logical 'OR' operation. */ export function or( first: BooleanExpression, @@ -7150,14 +7463,15 @@ export function or( * @beta * Creates an expression that returns the value of the base expression raised to the power of the exponent expression. * + * @example * ```typescript * // Raise the value of the 'base' field to the power of the 'exponent' field. * pow(field("base"), field("exponent")); * ``` * - * @param base The expression to raise to the power of the exponent. - * @param exponent The expression to raise the base to the power of. - * @return A new `Expr` representing the power operation. + * @param base - The expression to raise to the power of the exponent. + * @param exponent - The expression to raise the base to the power of. + * @returns A new `Expression` representing the power operation. */ export function pow(base: Expression, exponent: Expression): FunctionExpression; @@ -7165,14 +7479,15 @@ export function pow(base: Expression, exponent: Expression): FunctionExpression; * @beta * Creates an expression that returns the value of the base expression raised to the power of the exponent. * + * @example * ```typescript * // Raise the value of the 'base' field to the power of 2. * pow(field("base"), 2); * ``` * - * @param base The expression to raise to the power of the exponent. - * @param exponent The constant value to raise the base to the power of. - * @return A new `Expr` representing the power operation. + * @param base - The expression to raise to the power of the exponent. + * @param exponent - The constant value to raise the base to the power of. + * @returns A new `Expression` representing the power operation. */ export function pow(base: Expression, exponent: number): FunctionExpression; @@ -7180,14 +7495,15 @@ export function pow(base: Expression, exponent: number): FunctionExpression; * @beta * Creates an expression that returns the value of the base field raised to the power of the exponent expression. * + * @example * ```typescript * // Raise the value of the 'base' field to the power of the 'exponent' field. * pow("base", field("exponent")); * ``` * - * @param base The name of the field to raise to the power of the exponent. - * @param exponent The expression to raise the base to the power of. - * @return A new `Expr` representing the power operation. + * @param base - The name of the field to raise to the power of the exponent. + * @param exponent - The expression to raise the base to the power of. + * @returns A new `Expression` representing the power operation. */ export function pow(base: string, exponent: Expression): FunctionExpression; @@ -7195,14 +7511,15 @@ export function pow(base: string, exponent: Expression): FunctionExpression; * @beta * Creates an expression that returns the value of the base field raised to the power of the exponent. * + * @example * ```typescript * // Raise the value of the 'base' field to the power of 2. * pow("base", 2); * ``` * - * @param base The name of the field to raise to the power of the exponent. - * @param exponent The constant value to raise the base to the power of. - * @return A new `Expr` representing the power operation. + * @param base - The name of the field to raise to the power of the exponent. + * @param exponent - The constant value to raise the base to the power of. + * @returns A new `Expression` representing the power operation. */ export function pow(base: string, exponent: number): FunctionExpression; export function pow( @@ -7216,13 +7533,14 @@ export function pow( * @beta * Creates an expression that rounds a numeric value to the nearest whole number. * + * @example * ```typescript * // Round the value of the 'price' field. * round("price"); * ``` * - * @param fieldName The name of the field to round. - * @return A new `Expr` representing the rounded value. + * @param fieldName - The name of the field to round. + * @returns A new `Expression` representing the rounded value. */ export function round(fieldName: string): FunctionExpression; @@ -7230,13 +7548,14 @@ export function round(fieldName: string): FunctionExpression; * @beta * Creates an expression that rounds a numeric value to the nearest whole number. * + * @example * ```typescript * // Round the value of the 'price' field. * round(field("price")); * ``` * - * @param expression An expression evaluating to a numeric value, which will be rounded. - * @return A new `Expr` representing the rounded value. + * @param expression - An expression evaluating to a numeric value, which will be rounded. + * @returns A new `Expression` representing the rounded value. */ export function round(expression: Expression): FunctionExpression; @@ -7244,14 +7563,15 @@ export function round(expression: Expression): FunctionExpression; * @beta * Creates an expression that rounds a numeric value to the specified number of decimal places. * + * @example * ```typescript * // Round the value of the 'price' field to two decimal places. * round("price", 2); * ``` * - * @param fieldName The name of the field to round. - * @param decimalPlaces A constant or expression specifying the rounding precision in decimal places. - * @return A new `Expr` representing the rounded value. + * @param fieldName - The name of the field to round. + * @param decimalPlaces - A constant or expression specifying the rounding precision in decimal places. + * @returns A new `Expression` representing the rounded value. */ export function round( fieldName: string, @@ -7262,14 +7582,15 @@ export function round( * @beta * Creates an expression that rounds a numeric value to the specified number of decimal places. * + * @example * ```typescript * // Round the value of the 'price' field to two decimal places. * round(field("price"), constant(2)); * ``` * - * @param expression An expression evaluating to a numeric value, which will be rounded. - * @param decimalPlaces A constant or expression specifying the rounding precision in decimal places. - * @return A new `Expr` representing the rounded value. + * @param expression - An expression evaluating to a numeric value, which will be rounded. + * @param decimalPlaces - A constant or expression specifying the rounding precision in decimal places. + * @returns A new `Expression` representing the rounded value. */ export function round( expression: Expression, @@ -7290,13 +7611,14 @@ export function round( * @beta * Creates an expression that returns the collection ID from a path. * + * @example * ```typescript * // Get the collection ID from a path. * collectionId("__name__"); * ``` * - * @param fieldName The name of the field to get the collection ID from. - * @return A new {@code Expr} representing the collectionId operation. + * @param fieldName - The name of the field to get the collection ID from. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the collectionId operation. */ export function collectionId(fieldName: string): FunctionExpression; @@ -7304,13 +7626,14 @@ export function collectionId(fieldName: string): FunctionExpression; * @beta * Creates an expression that returns the collection ID from a path. * + * @example * ```typescript * // Get the collection ID from a path. * collectionId(field("__name__")); * ``` * - * @param expression An expression evaluating to a path, which the collection ID will be extracted from. - * @return A new {@code Expr} representing the collectionId operation. + * @param expression - An expression evaluating to a path, which the collection ID will be extracted from. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the collectionId operation. */ export function collectionId(expression: Expression): FunctionExpression; export function collectionId(expr: Expression | string): FunctionExpression { @@ -7321,6 +7644,7 @@ export function collectionId(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that calculates the length of a string, array, map, vector, or bytes. * + * @example * ```typescript * // Get the length of the 'name' field. * length("name"); @@ -7329,8 +7653,8 @@ export function collectionId(expr: Expression | string): FunctionExpression { * length("cart"); * ``` * - * @param fieldName The name of the field to calculate the length of. - * @return A new `Expr` representing the length of the string, array, map, vector, or bytes. + * @param fieldName - The name of the field to calculate the length of. + * @returns A new `Expression` representing the length of the string, array, map, vector, or bytes. */ export function length(fieldName: string): FunctionExpression; @@ -7338,6 +7662,7 @@ export function length(fieldName: string): FunctionExpression; * @beta * Creates an expression that calculates the length of a string, array, map, vector, or bytes. * + * @example * ```typescript * // Get the length of the 'name' field. * length(field("name")); @@ -7346,8 +7671,8 @@ export function length(fieldName: string): FunctionExpression; * length(field("cart")); * ``` * - * @param expression An expression evaluating to a string, array, map, vector, or bytes, which the length will be calculated for. - * @return A new `Expr` representing the length of the string, array, map, vector, or bytes. + * @param expression - An expression evaluating to a string, array, map, vector, or bytes, which the length will be calculated for. + * @returns A new `Expression` representing the length of the string, array, map, vector, or bytes. */ export function length(expression: Expression): FunctionExpression; export function length(expr: Expression | string): FunctionExpression { @@ -7358,13 +7683,14 @@ export function length(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that computes the natural logarithm of a numeric value. * + * @example * ```typescript * // Compute the natural logarithm of the 'value' field. * ln("value"); * ``` * - * @param fieldName The name of the field to compute the natural logarithm of. - * @return A new `Expr` representing the natural logarithm of the numeric value. + * @param fieldName - The name of the field to compute the natural logarithm of. + * @returns A new `Expression` representing the natural logarithm of the numeric value. */ export function ln(fieldName: string): FunctionExpression; @@ -7372,13 +7698,14 @@ export function ln(fieldName: string): FunctionExpression; * @beta * Creates an expression that computes the natural logarithm of a numeric value. * + * @example * ```typescript * // Compute the natural logarithm of the 'value' field. * ln(field("value")); * ``` * - * @param expression An expression evaluating to a numeric value, which the natural logarithm will be computed for. - * @return A new `Expr` representing the natural logarithm of the numeric value. + * @param expression - An expression evaluating to a numeric value, which the natural logarithm will be computed for. + * @returns A new `Expression` representing the natural logarithm of the numeric value. */ export function ln(expression: Expression): FunctionExpression; export function ln(expr: Expression | string): FunctionExpression { @@ -7389,28 +7716,30 @@ export function ln(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that computes the logarithm of an expression to a given base. * + * @example * ```typescript * // Compute the logarithm of the 'value' field with base 10. * log(field("value"), 10); * ``` * - * @param expression An expression evaluating to a numeric value, which the logarithm will be computed for. - * @param base The base of the logarithm. - * @return A new {@code Expr} representing the logarithm of the numeric value. + * @param expression - An expression evaluating to a numeric value, which the logarithm will be computed for. + * @param base - The base of the logarithm. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value. */ export function log(expression: Expression, base: number): FunctionExpression; /** * @beta * Creates an expression that computes the logarithm of an expression to a given base. * + * @example * ```typescript * // Compute the logarithm of the 'value' field with the base in the 'base' field. * log(field("value"), field("base")); * ``` * - * @param expression An expression evaluating to a numeric value, which the logarithm will be computed for. - * @param base The base of the logarithm. - * @return A new {@code Expr} representing the logarithm of the numeric value. + * @param expression - An expression evaluating to a numeric value, which the logarithm will be computed for. + * @param base - The base of the logarithm. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value. */ export function log( expression: Expression, @@ -7420,28 +7749,30 @@ export function log( * @beta * Creates an expression that computes the logarithm of a field to a given base. * + * @example * ```typescript * // Compute the logarithm of the 'value' field with base 10. * log("value", 10); * ``` * - * @param fieldName The name of the field to compute the logarithm of. - * @param base The base of the logarithm. - * @return A new {@code Expr} representing the logarithm of the numeric value. + * @param fieldName - The name of the field to compute the logarithm of. + * @param base - The base of the logarithm. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value. */ export function log(fieldName: string, base: number): FunctionExpression; /** * @beta * Creates an expression that computes the logarithm of a field to a given base. * + * @example * ```typescript * // Compute the logarithm of the 'value' field with the base in the 'base' field. * log("value", field("base")); * ``` * - * @param fieldName The name of the field to compute the logarithm of. - * @param base The base of the logarithm. - * @return A new {@code Expr} representing the logarithm of the numeric value. + * @param fieldName - The name of the field to compute the logarithm of. + * @param base - The base of the logarithm. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the logarithm of the numeric value. */ export function log(fieldName: string, base: Expression): FunctionExpression; export function log( @@ -7458,26 +7789,28 @@ export function log( * @beta * Creates an expression that computes the square root of a numeric value. * + * @example * ```typescript * // Compute the square root of the 'value' field. * sqrt(field("value")); * ``` * - * @param expression An expression evaluating to a numeric value, which the square root will be computed for. - * @return A new {@code Expr} representing the square root of the numeric value. + * @param expression - An expression evaluating to a numeric value, which the square root will be computed for. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the square root of the numeric value. */ export function sqrt(expression: Expression): FunctionExpression; /** * @beta * Creates an expression that computes the square root of a numeric value. * + * @example * ```typescript * // Compute the square root of the 'value' field. * sqrt("value"); * ``` * - * @param fieldName The name of the field to compute the square root of. - * @return A new {@code Expr} representing the square root of the numeric value. + * @param fieldName - The name of the field to compute the square root of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the square root of the numeric value. */ export function sqrt(fieldName: string): FunctionExpression; export function sqrt(expr: Expression | string): FunctionExpression { @@ -7488,13 +7821,14 @@ export function sqrt(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that reverses a string. * + * @example * ```typescript * // Reverse the value of the 'myString' field. * strReverse(field("myString")); * ``` * - * @param stringExpression An expression evaluating to a string value, which will be reversed. - * @return A new {@code Expr} representing the reversed string. + * @param stringExpression - An expression evaluating to a string value, which will be reversed. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string. */ export function stringReverse(stringExpression: Expression): FunctionExpression; @@ -7502,13 +7836,14 @@ export function stringReverse(stringExpression: Expression): FunctionExpression; * @beta * Creates an expression that reverses a string value in the specified field. * + * @example * ```typescript * // Reverse the value of the 'myString' field. * strReverse("myString"); * ``` * - * @param field The name of the field representing the string to reverse. - * @return A new {@code Expr} representing the reversed string. + * @param field - The name of the field representing the string to reverse. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the reversed string. */ export function stringReverse(field: string): FunctionExpression; export function stringReverse(expr: Expression | string): FunctionExpression { @@ -7519,15 +7854,16 @@ export function stringReverse(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. * + * @example * ```typescript * // Concatenate the 'firstName' and 'lastName' fields with a space in between. * concat(field("firstName"), " ", field("lastName")) * ``` * - * @param first The first expressions to concatenate. - * @param second The second literal or expression to concatenate. - * @param others Additional literals or expressions to concatenate. - * @return A new `Expression` representing the concatenation. + * @param first - The first expressions to concatenate. + * @param second - The second literal or expression to concatenate. + * @param others - Additional literals or expressions to concatenate. + * @returns A new `Expression` representing the concatenation. */ export function concat( first: Expression, @@ -7539,15 +7875,16 @@ export function concat( * @beta * Creates an expression that concatenates strings, arrays, or blobs. Types cannot be mixed. * + * @example * ```typescript * // Concatenate a field with a literal string. * concat(field("firstName"), "Doe") * ``` * - * @param fieldName The name of a field to concatenate. - * @param second The second literal or expression to concatenate. - * @param others Additional literal or expressions to concatenate. - * @return A new `Expression` representing the concatenation. + * @param fieldName - The name of a field to concatenate. + * @param second - The second literal or expression to concatenate. + * @param others - Additional literal or expressions to concatenate. + * @returns A new `Expression` representing the concatenation. */ export function concat( fieldName: string, @@ -7571,8 +7908,8 @@ export function concat( * @beta * Creates an expression that computes the absolute value of a numeric value. * - * @param expr The expression to compute the absolute value of. - * @return A new {@code Expr} representing the absolute value of the numeric value. + * @param expr - The expression to compute the absolute value of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the absolute value of the numeric value. */ export function abs(expr: Expression): FunctionExpression; @@ -7580,8 +7917,8 @@ export function abs(expr: Expression): FunctionExpression; * @beta * Creates an expression that computes the absolute value of a numeric value. * - * @param fieldName The field to compute the absolute value of. - * @return A new {@code Expr} representing the absolute value of the numeric value. + * @param fieldName - The field to compute the absolute value of. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the absolute value of the numeric value. */ export function abs(fieldName: string): FunctionExpression; export function abs(expr: Expression | string): FunctionExpression { @@ -7593,15 +7930,16 @@ export function abs(expr: Expression | string): FunctionExpression { * Creates an expression that returns the `elseExpr` argument if `ifExpr` is absent, else return * the result of the `ifExpr` argument evaluation. * + * @example * ```typescript * // Returns the value of the optional field 'optional_field', or returns 'default_value' * // if the field is absent. * ifAbsent(field("optional_field"), constant("default_value")) * ``` * - * @param ifExpr The expression to check for absence. - * @param elseExpr The expression that will be evaluated and returned if [ifExpr] is absent. - * @return A new Expression representing the ifAbsent operation. + * @param ifExpr - The expression to check for absence. + * @param elseExpr - The expression that will be evaluated and returned if [ifExpr] is absent. + * @returns A new Expression representing the ifAbsent operation. */ export function ifAbsent(ifExpr: Expression, elseExpr: Expression): Expression; @@ -7610,15 +7948,16 @@ export function ifAbsent(ifExpr: Expression, elseExpr: Expression): Expression; * Creates an expression that returns the `elseValue` argument if `ifExpr` is absent, else * return the result of the `ifExpr` argument evaluation. * + * @example * ```typescript * // Returns the value of the optional field 'optional_field', or returns 'default_value' * // if the field is absent. * ifAbsent(field("optional_field"), "default_value") * ``` * - * @param ifExpr The expression to check for absence. - * @param elseValue The value that will be returned if `ifExpr` evaluates to an absent value. - * @return A new [Expression] representing the ifAbsent operation. + * @param ifExpr - The expression to check for absence. + * @param elseValue - The value that will be returned if `ifExpr` evaluates to an absent value. + * @returns A new [Expression] representing the ifAbsent operation. */ export function ifAbsent(ifExpr: Expression, elseValue: unknown): Expression; @@ -7627,16 +7966,17 @@ export function ifAbsent(ifExpr: Expression, elseValue: unknown): Expression; * Creates an expression that returns the `elseExpr` argument if `ifFieldName` is absent, else * return the value of the field. * + * @example * ```typescript * // Returns the value of the optional field 'optional_field', or returns the value of * // 'default_field' if 'optional_field' is absent. * ifAbsent("optional_field", field("default_field")) * ``` * - * @param ifFieldName The field to check for absence. - * @param elseExpr The expression that will be evaluated and returned if `ifFieldName` is + * @param ifFieldName - The field to check for absence. + * @param elseExpr - The expression that will be evaluated and returned if `ifFieldName` is * absent. - * @return A new Expression representing the ifAbsent operation. + * @returns A new Expression representing the ifAbsent operation. */ export function ifAbsent(ifFieldName: string, elseExpr: Expression): Expression; @@ -7645,15 +7985,16 @@ export function ifAbsent(ifFieldName: string, elseExpr: Expression): Expression; * Creates an expression that returns the `elseValue` argument if `ifFieldName` is absent, else * return the value of the field. * + * @example * ```typescript * // Returns the value of the optional field 'optional_field', or returns 'default_value' * // if the field is absent. * ifAbsent("optional_field", "default_value") * ``` * - * @param ifFieldName The field to check for absence. - * @param elseValue The value that will be returned if [ifFieldName] is absent. - * @return A new Expression representing the ifAbsent operation. + * @param ifFieldName - The field to check for absence. + * @param elseValue - The value that will be returned if [ifFieldName] is absent. + * @returns A new Expression representing the ifAbsent operation. */ export function ifAbsent( ifFieldName: string | Expression, @@ -7672,14 +8013,15 @@ export function ifAbsent( * @beta * Creates an expression that joins the elements of an array into a string. * + * @example * ```typescript * // Join the elements of the 'tags' field with a comma and space. * join("tags", ", ") * ``` * - * @param arrayFieldName The name of the field containing the array. - * @param delimiter The string to use as a delimiter. - * @return A new Expression representing the join operation. + * @param arrayFieldName - The name of the field containing the array. + * @param delimiter - The string to use as a delimiter. + * @returns A new Expression representing the join operation. */ export function join(arrayFieldName: string, delimiter: string): Expression; @@ -7687,14 +8029,15 @@ export function join(arrayFieldName: string, delimiter: string): Expression; * @beta * Creates an expression that joins the elements of an array into a string. * + * @example * ```typescript * // Join an array of string using the delimiter from the 'separator' field. * join(array(['foo', 'bar']), field("separator")) * ``` * - * @param arrayExpression An expression that evaluates to an array. - * @param delimiterExpression The expression that evaluates to the delimiter string. - * @return A new Expression representing the join operation. + * @param arrayExpression - An expression that evaluates to an array. + * @param delimiterExpression - The expression that evaluates to the delimiter string. + * @returns A new Expression representing the join operation. */ export function join( arrayExpression: Expression, @@ -7705,14 +8048,15 @@ export function join( * @beta * Creates an expression that joins the elements of an array into a string. * + * @example * ```typescript * // Join the elements of the 'tags' field with a comma and space. * join(field("tags"), ", ") * ``` * - * @param arrayExpression An expression that evaluates to an array. - * @param delimiter The string to use as a delimiter. - * @return A new Expression representing the join operation. + * @param arrayExpression - An expression that evaluates to an array. + * @param delimiter - The string to use as a delimiter. + * @returns A new Expression representing the join operation. */ export function join( arrayExpression: Expression, @@ -7723,14 +8067,15 @@ export function join( * @beta * Creates an expression that joins the elements of an array into a string. * + * @example * ```typescript * // Join the elements of the 'tags' field with the delimiter from the 'separator' field. * join('tags', field("separator")) * ``` * - * @param arrayFieldName The name of the field containing the array. - * @param delimiterExpression The expression that evaluates to the delimiter string. - * @return A new Expression representing the join operation. + * @param arrayFieldName - The name of the field containing the array. + * @param delimiterExpression - The expression that evaluates to the delimiter string. + * @returns A new Expression representing the join operation. */ export function join( arrayFieldName: string, @@ -7749,13 +8094,14 @@ export function join( * @beta * Creates an expression that computes the base-10 logarithm of a numeric value. * + * @example * ```typescript * // Compute the base-10 logarithm of the 'value' field. * log10("value"); * ``` * - * @param fieldName The name of the field to compute the base-10 logarithm of. - * @return A new `Expr` representing the base-10 logarithm of the numeric value. + * @param fieldName - The name of the field to compute the base-10 logarithm of. + * @returns A new `Expression` representing the base-10 logarithm of the numeric value. */ export function log10(fieldName: string): FunctionExpression; @@ -7763,13 +8109,14 @@ export function log10(fieldName: string): FunctionExpression; * @beta * Creates an expression that computes the base-10 logarithm of a numeric value. * + * @example * ```typescript * // Compute the base-10 logarithm of the 'value' field. * log10(field("value")); * ``` * - * @param expression An expression evaluating to a numeric value, which the base-10 logarithm will be computed for. - * @return A new `Expr` representing the base-10 logarithm of the numeric value. + * @param expression - An expression evaluating to a numeric value, which the base-10 logarithm will be computed for. + * @returns A new `Expression` representing the base-10 logarithm of the numeric value. */ export function log10(expression: Expression): FunctionExpression; export function log10(expr: Expression | string): FunctionExpression { @@ -7780,13 +8127,14 @@ export function log10(expr: Expression | string): FunctionExpression { * @beta * Creates an expression that computes the sum of the elements in an array. * + * @example * ```typescript * // Compute the sum of the elements in the 'scores' field. * arraySum("scores"); * ``` * - * @param fieldName The name of the field to compute the sum of. - * @return A new `Expr` representing the sum of the elements in the array. + * @param fieldName - The name of the field to compute the sum of. + * @returns A new `Expression` representing the sum of the elements in the array. */ export function arraySum(fieldName: string): FunctionExpression; @@ -7794,13 +8142,14 @@ export function arraySum(fieldName: string): FunctionExpression; * @beta * Creates an expression that computes the sum of the elements in an array. * + * @example * ```typescript * // Compute the sum of the elements in the 'scores' field. * arraySum(field("scores")); * ``` * - * @param expression An expression evaluating to a numeric array, which the sum will be computed for. - * @return A new `Expr` representing the sum of the elements in the array. + * @param expression - An expression evaluating to a numeric array, which the sum will be computed for. + * @returns A new `Expression` representing the sum of the elements in the array. */ export function arraySum(expression: Expression): FunctionExpression; export function arraySum(expr: Expression | string): FunctionExpression { @@ -7817,10 +8166,10 @@ export function arraySum(expr: Expression | string): FunctionExpression { * split('scoresCsv', ',') * ``` * - * @param fieldName Split the value in this field. - * @param delimiter Split on this delimiter. + * @param fieldName - Split the value in this field. + * @param delimiter - Split on this delimiter. * - * @return A new {@code Expression} representing the split function. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function. */ export function split(fieldName: string, delimiter: string): FunctionExpression; @@ -7834,10 +8183,10 @@ export function split(fieldName: string, delimiter: string): FunctionExpression; * split('scores', conditional(field('format').equal('csv'), constant(','), constant(':')) * ``` * - * @param fieldName Split the value in this field. - * @param delimiter Split on this delimiter returned by evaluating this expression. + * @param fieldName - Split the value in this field. + * @param delimiter - Split on this delimiter returned by evaluating this expression. * - * @return A new {@code Expression} representing the split function. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function. */ export function split( fieldName: string, @@ -7854,10 +8203,10 @@ export function split( * split(field('scoresCsv'), ',') * ``` * - * @param expression Split the result of this expression. - * @param delimiter Split on this delimiter. + * @param expression - Split the result of this expression. + * @param delimiter - Split on this delimiter. * - * @return A new {@code Expression} representing the split function. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function. */ export function split( expression: Expression, @@ -7874,10 +8223,10 @@ export function split( * split(field('scores'), conditional(field('format').equal('csv'), constant(','), constant(':')) * ``` * - * @param expression Split the result of this expression. - * @param delimiter Split on this delimiter returned by evaluating this expression. + * @param expression - Split the result of this expression. + * @param delimiter - Split on this delimiter returned by evaluating this expression. * - * @return A new {@code Expression} representing the split function. + * @returns A new {@link @firebase/firestore/pipelines#Expression} representing the split function. */ export function split( expression: Expression, @@ -7902,11 +8251,11 @@ export function split( * field('createdAt').timestampTruncate('day') * ``` * - * @param fieldName Truncate the timestamp value contained in this field. - * @param granularity The granularity to truncate to. - * @param timezone The timezone to use for truncation. Valid values are from + * @param fieldName - Truncate the timestamp value contained in this field. + * @param granularity - The granularity to truncate to. + * @param timezone - The timezone to use for truncation. Valid values are from * the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". - * @return A new {Expression} representing the truncated timestamp. + * @returns A new `Expression` representing the truncated timestamp. */ export function timestampTruncate( fieldName: string, @@ -7924,11 +8273,11 @@ export function timestampTruncate( * field('createdAt').timestampTruncate(field('granularity')) * ``` * - * @param fieldName Truncate the timestamp value contained in this field. - * @param granularity The granularity to truncate to. - * @param timezone The timezone to use for truncation. Valid values are from + * @param fieldName - Truncate the timestamp value contained in this field. + * @param granularity - The granularity to truncate to. + * @param timezone - The timezone to use for truncation. Valid values are from * the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". - * @return A new {Expression} representing the truncated timestamp. + * @returns A new `Expression` representing the truncated timestamp. */ export function timestampTruncate( fieldName: string, @@ -7946,11 +8295,11 @@ export function timestampTruncate( * field('createdAt').timestampTruncate('day') * ``` * - * @param timestampExpression Truncate the timestamp value that is returned by this expression. - * @param granularity The granularity to truncate to. - * @param timezone The timezone to use for truncation. Valid values are from + * @param timestampExpression - Truncate the timestamp value that is returned by this expression. + * @param granularity - The granularity to truncate to. + * @param timezone - The timezone to use for truncation. Valid values are from * the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". - * @return A new {Expression} representing the truncated timestamp. + * @returns A new `Expression` representing the truncated timestamp. */ export function timestampTruncate( timestampExpression: Expression, @@ -7968,11 +8317,11 @@ export function timestampTruncate( * field('createdAt').timestampTruncate(field('granularity')) * ``` * - * @param timestampExpression Truncate the timestamp value that is returned by this expression. - * @param granularity The granularity to truncate to. - * @param timezone The timezone to use for truncation. Valid values are from + * @param timestampExpression - Truncate the timestamp value that is returned by this expression. + * @param granularity - The granularity to truncate to. + * @param timezone - The timezone to use for truncation. Valid values are from * the TZ database (e.g., "America/Los_Angeles") or in the format "Etc/GMT-1". - * @return A new {Expression} representing the truncated timestamp. + * @returns A new `Expression` representing the truncated timestamp. */ export function timestampTruncate( timestampExpression: Expression, @@ -8003,7 +8352,7 @@ export function timestampTruncate( * type('title') * ``` * - * @return A new {Expression} representing the data type. + * @returns A new `Expression` representing the data type. */ export function type(fieldName: string): FunctionExpression; /** @@ -8016,7 +8365,7 @@ export function type(fieldName: string): FunctionExpression; * type(conditional(exists('foo'), constant(1), constant(true))) * ``` * - * @return A new {Expression} representing the data type. + * @returns A new `Expression` representing the data type. */ export function type(expression: Expression): FunctionExpression; export function type( @@ -8030,32 +8379,34 @@ export function type( /** * @beta * - * Creates an {@link Ordering} that sorts documents in ascending order based on an expression. + * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in ascending order based on an expression. * + * @example * ```typescript * // Sort documents by the 'name' field in lowercase in ascending order * firestore.pipeline().collection("users") * .sort(ascending(field("name").toLower())); * ``` * - * @param expr The expression to create an ascending ordering for. - * @return A new `Ordering` for ascending sorting. + * @param expr - The expression to create an ascending ordering for. + * @returns A new `Ordering` for ascending sorting. */ export function ascending(expr: Expression): Ordering; /** * @beta * - * Creates an {@link Ordering} that sorts documents in ascending order based on a field. + * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in ascending order based on a field. * + * @example * ```typescript * // Sort documents by the 'name' field in ascending order * firestore.pipeline().collection("users") * .sort(ascending("name")); * ``` * - * @param fieldName The field to create an ascending ordering for. - * @return A new `Ordering` for ascending sorting. + * @param fieldName - The field to create an ascending ordering for. + * @returns A new `Ordering` for ascending sorting. */ export function ascending(fieldName: string): Ordering; export function ascending(field: Expression | string): Ordering { @@ -8065,32 +8416,34 @@ export function ascending(field: Expression | string): Ordering { /** * @beta * - * Creates an {@link Ordering} that sorts documents in descending order based on an expression. + * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in descending order based on an expression. * + * @example * ```typescript * // Sort documents by the 'name' field in lowercase in descending order * firestore.pipeline().collection("users") * .sort(descending(field("name").toLower())); * ``` * - * @param expr The expression to create a descending ordering for. - * @return A new `Ordering` for descending sorting. + * @param expr - The expression to create a descending ordering for. + * @returns A new `Ordering` for descending sorting. */ export function descending(expr: Expression): Ordering; /** * @beta * - * Creates an {@link Ordering} that sorts documents in descending order based on a field. + * Creates an {@link @firebase/firestore/pipelines#Ordering} that sorts documents in descending order based on a field. * + * @example * ```typescript * // Sort documents by the 'name' field in descending order * firestore.pipeline().collection("users") * .sort(descending("name")); * ``` * - * @param fieldName The field to create a descending ordering for. - * @return A new `Ordering` for descending sorting. + * @param fieldName - The field to create a descending ordering for. + * @returns A new `Ordering` for descending sorting. */ export function descending(fieldName: string): Ordering; export function descending(field: Expression | string): Ordering { diff --git a/packages/firestore/src/lite-api/geo_point.ts b/packages/firestore/src/lite-api/geo_point.ts index 75194049f8..0545f8bbc3 100644 --- a/packages/firestore/src/lite-api/geo_point.ts +++ b/packages/firestore/src/lite-api/geo_point.ts @@ -116,7 +116,7 @@ export class GeoPoint { /** * Builds a `GeoPoint` instance from a JSON object created by {@link GeoPoint.toJSON}. * - * @param json a JSON object represention of a `GeoPoint` instance + * @param json - a JSON object represention of a `GeoPoint` instance * @returns an instance of {@link GeoPoint} if the JSON object could be parsed. Throws a * {@link FirestoreError} if an error occurs. */ diff --git a/packages/firestore/src/lite-api/pipeline-result.ts b/packages/firestore/src/lite-api/pipeline-result.ts index a853a65299..219d2abb8a 100644 --- a/packages/firestore/src/lite-api/pipeline-result.ts +++ b/packages/firestore/src/lite-api/pipeline-result.ts @@ -31,7 +31,7 @@ import { AbstractUserDataWriter } from './user_data_writer'; * @beta * Represents the results of a Firestore pipeline execution. * - * A `PipelineSnapshot` contains zero or more {@link PipelineResult} objects + * A `PipelineSnapshot` contains zero or more {@link @firebase/firestore/pipelines#PipelineResult} objects * representing the documents returned by a pipeline query. It provides methods * to iterate over the documents and access metadata about the query results. * @@ -73,7 +73,6 @@ export class PipelineSnapshot { * @beta * The time at which the pipeline producing this result is executed. * - * @type {Timestamp} * @readonly * */ @@ -91,7 +90,7 @@ export class PipelineSnapshot { * @beta * * A PipelineResult contains data read from a Firestore Pipeline. The data can be extracted with the - * {@link #data()} or {@link #get(String)} methods. + * {@link @firebase/firestore/pipelines#PipelineResult.data} or {@link @firebase/firestore/pipelines#PipelineResult.(get:1)} methods. * *

If the PipelineResult represents a non-document result, `ref` will return a undefined * value. @@ -118,12 +117,12 @@ export class PipelineResult { * @private * @internal * - * @param userDataWriter The serializer used to encode/decode protobuf. - * @param ref The reference to the document. - * @param fields The fields of the Firestore `Document` Protobuf backing + * @param userDataWriter - The serializer used to encode/decode protobuf. + * @param ref - The reference to the document. + * @param fields - The fields of the Firestore `Document` Protobuf backing * this document. - * @param createTime The time when the document was created if the result is a document, undefined otherwise. - * @param updateTime The time when the document was last updated if the result is a document, undefined otherwise. + * @param createTime - The time when the document was created if the result is a document, undefined otherwise. + * @param updateTime - The time when the document was last updated if the result is a document, undefined otherwise. */ constructor( userDataWriter: AbstractUserDataWriter, @@ -151,7 +150,6 @@ export class PipelineResult { * @beta * The ID of the document for which this PipelineResult contains data, if it is a document; otherwise `undefined`. * - * @type {string} * @readonly * */ @@ -163,7 +161,6 @@ export class PipelineResult { * @beta * The time the document was created. Undefined if this result is not a document. * - * @type {Timestamp|undefined} * @readonly */ get createTime(): Timestamp | undefined { @@ -175,7 +172,6 @@ export class PipelineResult { * The time the document was last updated (at the time the snapshot was * generated). Undefined if this result is not a document. * - * @type {Timestamp|undefined} * @readonly */ get updateTime(): Timestamp | undefined { @@ -186,7 +182,7 @@ export class PipelineResult { * @beta * Retrieves all fields in the result as an object. * - * @returns {T} An object containing all fields in the document or + * @returns An object containing all fields in the document or * 'undefined' if the document doesn't exist. * * @example @@ -222,9 +218,9 @@ export class PipelineResult { * @beta * Retrieves the field specified by `field`. * - * @param {string|FieldPath|Field} field The field path + * @param field - The field path * (e.g. 'foo' or 'foo.bar') to a specific field. - * @returns {*} The data at the specified field location or undefined if no + * @returns The data at the specified field location or `undefined` if no * such field exists. * * @example @@ -260,8 +256,8 @@ export class PipelineResult { /** * @beta * Test equality of two PipelineResults. - * @param left - * @param right + * @param left - First PipelineResult to compare. + * @param right - Second PipelineResult to compare. */ export function pipelineResultEqual( left: PipelineResult, diff --git a/packages/firestore/src/lite-api/pipeline-source.ts b/packages/firestore/src/lite-api/pipeline-source.ts index 0186ca3526..87f5a6a882 100644 --- a/packages/firestore/src/lite-api/pipeline-source.ts +++ b/packages/firestore/src/lite-api/pipeline-source.ts @@ -44,10 +44,10 @@ import { UserDataReader, UserDataSource } from './user_data_reader'; /** * @beta - * Provides the entry point for defining the data source of a Firestore {@link Pipeline}. + * Provides the entry point for defining the data source of a Firestore {@link @firebase/firestore/pipelines#Pipeline}. * - * Use the methods of this class (e.g., {@link PipelineSource#collection}, {@link PipelineSource#collectionGroup}, - * {@link PipelineSource#database}, or {@link PipelineSource#documents}) to specify the initial data + * Use the methods of this class (e.g., {@link @firebase/firestore/pipelines#PipelineSource.(collection:1)}, {@link @firebase/firestore/pipelines#PipelineSource.(collectionGroup:1)}, + * {@link @firebase/firestore/pipelines#PipelineSource.(database:1)}, or {@link @firebase/firestore/pipelines#PipelineSource.(documents:1)}) to specify the initial data * for your pipeline, such as a collection, a collection group, the entire database, or a set of specific documents. */ export class PipelineSource { @@ -194,10 +194,10 @@ export class PipelineSource { * @beta * Set the pipeline's source to the documents specified by the given paths and DocumentReferences. * - * @param docs An array of paths and DocumentReferences specifying the individual documents that will be the source of this pipeline. + * @param docs - An array of paths and DocumentReferences specifying the individual documents that will be the source of this pipeline. * The converters for these DocumentReferences will be ignored and not have an effect on this pipeline. * - * @throws {@FirestoreError} Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. + * @throws `FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. */ documents(docs: Array): PipelineType; @@ -207,7 +207,7 @@ export class PipelineSource { * * @param options - Options defining how this DocumentsStage is evaluated. * - * @throws {@FirestoreError} Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. + * @throws `FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. */ documents(options: DocumentsStageOptions): PipelineType; documents( @@ -252,9 +252,9 @@ export class PipelineSource { * @beta * Convert the given Query into an equivalent Pipeline. * - * @param query A Query to be converted into a Pipeline. + * @param query - A Query to be converted into a Pipeline. * - * @throws {@FirestoreError} Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. + * @throws `FirestoreError` Thrown if any of the provided DocumentReferences target a different project or database than the pipeline. */ createFrom(query: Query): Pipeline { return toPipeline(query._query, query.firestore); diff --git a/packages/firestore/src/lite-api/pipeline.ts b/packages/firestore/src/lite-api/pipeline.ts index 4352e30f4c..2dda90eaa4 100644 --- a/packages/firestore/src/lite-api/pipeline.ts +++ b/packages/firestore/src/lite-api/pipeline.ts @@ -107,6 +107,7 @@ import { AbstractUserDataWriter } from './user_data_writer'; * * Usage Examples: * + * @example * ```typescript * const db: Firestore; // Assumes a valid firestore instance. * @@ -167,14 +168,15 @@ export class Pipeline implements ProtoSerializable { * stages or constants. You can use this to create new fields or overwrite existing ones (if there * is name overlaps). * - * The added fields are defined using {@link Selectable}s, which can be: + * The added fields are defined using {@link @firebase/firestore/pipelines#Selectable}s, which can be: * - * - {@link Field}: References an existing document field. - * - {@link Expression}: Either a literal value (see {@link Constant}) or a computed value - * (see {@FunctionExpr}) with an assigned alias using {@link Expression#as}. + * - {@link @firebase/firestore/pipelines#Field}: References an existing document field. + * - {@link @firebase/firestore/pipelines#Expression}: Either a literal value (see {@link @firebase/firestore/pipelines#(constant:1)}) or a computed value + * with an assigned alias using {@link @firebase/firestore/pipelines#Expression.(as:1)}. * * Example: * + * @example * ```typescript * firestore.pipeline().collection("books") * .addFields( @@ -183,9 +185,9 @@ export class Pipeline implements ProtoSerializable { * ); * ``` * - * @param field The first field to add to the documents, specified as a {@link Selectable}. - * @param additionalFields Optional additional fields to add to the documents, specified as {@link Selectable}s. - * @return A new Pipeline object with this stage appended to the stage list. + * @param field - The first field to add to the documents, specified as a {@link @firebase/firestore/pipelines#Selectable}. + * @param additionalFields - Optional additional fields to add to the documents, specified as {@link @firebase/firestore/pipelines#Selectable}s. + * @returns A new Pipeline object with this stage appended to the stage list. */ addFields(field: Selectable, ...additionalFields: Selectable[]): Pipeline; /** @@ -196,14 +198,15 @@ export class Pipeline implements ProtoSerializable { * stages or constants. You can use this to create new fields or overwrite existing ones (if there * is name overlaps). * - * The added fields are defined using {@link Selectable}s, which can be: + * The added fields are defined using {@link @firebase/firestore/pipelines#Selectable}s, which can be: * - * - {@link Field}: References an existing document field. - * - {@link Expression}: Either a literal value (see {@link Constant}) or a computed value - * (see {@FunctionExpr}) with an assigned alias using {@link Expression#as}. + * - {@link @firebase/firestore/pipelines#Field}: References an existing document field. + * - {@link @firebase/firestore/pipelines#Expression}: Either a literal value (see {@link @firebase/firestore/pipelines#(constant:1)}) or a computed value + * with an assigned alias using {@link @firebase/firestore/pipelines#Expression.(as:1)}. * * Example: * + * @example * ```typescript * firestore.pipeline().collection("books") * .addFields( @@ -213,7 +216,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new Pipeline object with this stage appended to the stage list. + * @returns A new Pipeline object with this stage appended to the stage list. */ addFields(options: AddFieldsStageOptions): Pipeline; addFields( @@ -254,6 +257,7 @@ export class Pipeline implements ProtoSerializable { * * Example: * + * @example * ```typescript * firestore.pipeline().collection('books') * // removes field 'rating' and 'cost' from the previous stage outputs. @@ -263,9 +267,9 @@ export class Pipeline implements ProtoSerializable { * ); * ``` * - * @param fieldValue The first field to remove. - * @param additionalFields Optional additional fields to remove. - * @return A new Pipeline object with this stage appended to the stage list. + * @param fieldValue - The first field to remove. + * @param additionalFields - Optional additional fields to remove. + * @returns A new Pipeline object with this stage appended to the stage list. */ removeFields( fieldValue: Field | string, @@ -277,6 +281,7 @@ export class Pipeline implements ProtoSerializable { * * Example: * + * @example * ```typescript * firestore.pipeline().collection('books') * // removes field 'rating' and 'cost' from the previous stage outputs. @@ -287,7 +292,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new Pipeline object with this stage appended to the stage list. + * @returns A new Pipeline object with this stage appended to the stage list. */ removeFields(options: RemoveFieldsStageOptions): Pipeline; removeFields( @@ -326,21 +331,22 @@ export class Pipeline implements ProtoSerializable { * @beta * Selects or creates a set of fields from the outputs of previous stages. * - *

The selected fields are defined using {@link Selectable} expressions, which can be: + *

The selected fields are defined using {@link @firebase/firestore/pipelines#Selectable} expressions, which can be: * *

    - *
  • {@code string}: Name of an existing field
  • - *
  • {@link Field}: References an existing field.
  • - *
  • {@link Function}: Represents the result of a function with an assigned alias name using - * {@link Expression#as}
  • + *
  • `string` : Name of an existing field
  • + *
  • {@link @firebase/firestore/pipelines#Field}: References an existing field.
  • + *
  • {@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name using + * {@link @firebase/firestore/pipelines#Expression.(as:1)}
  • *
* *

If no selections are provided, the output of this stage is empty. Use {@link - * Pipeline#addFields} instead if only additions are + * @firebase/firestore/pipelines#Pipeline.(addFields:1)} instead if only additions are * desired. * *

Example: * + * @example * ```typescript * db.pipeline().collection("books") * .select( @@ -350,11 +356,11 @@ export class Pipeline implements ProtoSerializable { * ); * ``` * - * @param selection The first field to include in the output documents, specified as {@link - * Selectable} expression or string value representing the field name. - * @param additionalSelections Optional additional fields to include in the output documents, specified as {@link - * Selectable} expressions or {@code string} values representing field names. - * @return A new Pipeline object with this stage appended to the stage list. + * @param selection - The first field to include in the output documents, specified as {@link + * @firebase/firestore/pipelines#Selectable} expression or string value representing the field name. + * @param additionalSelections - Optional additional fields to include in the output documents, specified as {@link + * @firebase/firestore/pipelines#Selectable} expressions or `string` values representing field names. + * @returns A new Pipeline object with this stage appended to the stage list. */ select( selection: Selectable | string, @@ -364,21 +370,22 @@ export class Pipeline implements ProtoSerializable { * @beta * Selects or creates a set of fields from the outputs of previous stages. * - *

The selected fields are defined using {@link Selectable} expressions, which can be: + *

The selected fields are defined using {@link @firebase/firestore/pipelines#Selectable} expressions, which can be: * *

    - *
  • {@code string}: Name of an existing field
  • - *
  • {@link Field}: References an existing field.
  • - *
  • {@link Function}: Represents the result of a function with an assigned alias name using - * {@link Expression#as}
  • + *
  • `string`: Name of an existing field
  • + *
  • {@link @firebase/firestore/pipelines#Field}: References an existing field.
  • + *
  • {@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name using + * {@link @firebase/firestore/pipelines#Expression.(as:1)}
  • *
* *

If no selections are provided, the output of this stage is empty. Use {@link - * Pipeline#addFields} instead if only additions are + * @firebase/firestore/pipelines#Pipeline.(addFields:1)} instead if only additions are * desired. * *

Example: * + * @example * ```typescript * db.pipeline().collection("books") * .select( @@ -389,7 +396,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new Pipeline object with this stage appended to the stage list. + * @returns A new Pipeline object with this stage appended to the stage list. */ select(options: SelectStageOptions): Pipeline; select( @@ -429,22 +436,23 @@ export class Pipeline implements ProtoSerializable { /** * @beta * Filters the documents from previous stages to only include those matching the specified {@link - * BooleanExpression}. + * @firebase/firestore/pipelines#BooleanExpression}. * *

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. * You can filter documents based on their field values, using implementations of {@link - * BooleanExpression}, typically including but not limited to: + * @firebase/firestore/pipelines#BooleanExpression}, typically including but not limited to: * *

    - *
  • field comparators: {@link Function#eq}, {@link Function#lt} (less than), {@link - * Function#gt} (greater than), etc.
  • - *
  • logical operators: {@link Function#and}, {@link Function#or}, {@link Function#not}, etc.
  • - *
  • advanced functions: {@link Function#regexMatch}, {@link - * Function#arrayContains}, etc.
  • + *
  • field comparators: {@link @firebase/firestore/pipelines#Expression.(equal:1)}, {@link @firebase/firestore/pipelines#Expression.(lessThan:1)}, {@link + * @firebase/firestore/pipelines#Expression.(greaterThan:1)}, etc.
  • + *
  • logical operators: {@link @firebase/firestore/pipelines#Expression.(and:1)}, {@link @firebase/firestore/pipelines#Expression.(or:1)}, {@link @firebase/firestore/pipelines#Expression.(not:1)}, etc.
  • + *
  • advanced functions: {@link @firebase/firestore/pipelines#Expression.(regexMatch:1)}, {@link + * @firebase/firestore/pipelines#Expression.(arrayContains:1)}, etc.
  • *
* *

Example: * + * @example * ```typescript * firestore.pipeline().collection("books") * .where( @@ -455,29 +463,30 @@ export class Pipeline implements ProtoSerializable { * ); * ``` * - * @param condition The {@link BooleanExpression} to apply. - * @return A new Pipeline object with this stage appended to the stage list. + * @param condition - The {@link @firebase/firestore/pipelines#BooleanExpression} to apply. + * @returns A new Pipeline object with this stage appended to the stage list. */ where(condition: BooleanExpression): Pipeline; /** * @beta * Filters the documents from previous stages to only include those matching the specified {@link - * BooleanExpression}. + * @firebase/firestore/pipelines#BooleanExpression}. * *

This stage allows you to apply conditions to the data, similar to a "WHERE" clause in SQL. * You can filter documents based on their field values, using implementations of {@link - * BooleanExpression}, typically including but not limited to: + * @firebase/firestore/pipelines#BooleanExpression}, typically including but not limited to: * *

    - *
  • field comparators: {@link Function#eq}, {@link Function#lt} (less than), {@link - * Function#gt} (greater than), etc.
  • - *
  • logical operators: {@link Function#and}, {@link Function#or}, {@link Function#not}, etc.
  • - *
  • advanced functions: {@link Function#regexMatch}, {@link - * Function#arrayContains}, etc.
  • + *
  • field comparators: {@link @firebase/firestore/pipelines#Expression.(eq:1)}, {@link @firebase/firestore/pipelines#Expression.(lt:1)} (less than), {@link + * @firebase/firestore/pipelines#Expression.(greaterThan:1)}, etc.
  • + *
  • logical operators: {@link @firebase/firestore/pipelines#Expression.(and:1)}, {@link @firebase/firestore/pipelines#Expression.(or:1)}, {@link @firebase/firestore/pipelines#Expression.(not:1)}, etc.
  • + *
  • advanced functions: {@link @firebase/firestore/pipelines#Expression.(regexMatch:1)}, {@link + * @firebase/firestore/pipelines#Expression.(arrayContains:1)}, etc.
  • *
* *

Example: * + * @example * ```typescript * firestore.pipeline().collection("books") * .where( @@ -489,7 +498,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new Pipeline object with this stage appended to the stage list. + * @returns A new Pipeline object with this stage appended to the stage list. */ where(options: WhereStageOptions): Pipeline; where(conditionOrOptions: BooleanExpression | WhereStageOptions): Pipeline { @@ -519,11 +528,12 @@ export class Pipeline implements ProtoSerializable { * Skips the first `offset` number of documents from the results of previous stages. * *

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve - * results in chunks. It is typically used in conjunction with {@link #limit} to control the + * results in chunks. It is typically used in conjunction with {@link @firebase/firestore/pipelines#Pipeline.limit} to control the * size of each page. * *

Example: * + * @example * ```typescript * // Retrieve the second page of 20 results * firestore.pipeline().collection('books') @@ -532,8 +542,8 @@ export class Pipeline implements ProtoSerializable { * .limit(20); // Take the next 20 results * ``` * - * @param offset The number of documents to skip. - * @return A new Pipeline object with this stage appended to the stage list. + * @param offset - The number of documents to skip. + * @returns A new Pipeline object with this stage appended to the stage list. */ offset(offset: number): Pipeline; /** @@ -541,11 +551,12 @@ export class Pipeline implements ProtoSerializable { * Skips the first `offset` number of documents from the results of previous stages. * *

This stage is useful for implementing pagination in your pipelines, allowing you to retrieve - * results in chunks. It is typically used in conjunction with {@link #limit} to control the + * results in chunks. It is typically used in conjunction with {@link @firebase/firestore/pipelines#Pipeline.limit} to control the * size of each page. * *

Example: * + * @example * ```typescript * // Retrieve the second page of 20 results * firestore.pipeline().collection('books') @@ -555,7 +566,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new Pipeline object with this stage appended to the stage list. + * @returns A new Pipeline object with this stage appended to the stage list. */ offset(options: OffsetStageOptions): Pipeline; offset(offsetOrOptions: number | OffsetStageOptions): Pipeline { @@ -593,7 +604,7 @@ export class Pipeline implements ProtoSerializable { * a potentially large result set. It's often used for: * *

    - *
  • **Pagination:** In combination with {@link #offset} to retrieve specific pages of + *
  • **Pagination:** In combination with {@link @firebase/firestore/pipelines#Pipeline.offset} to retrieve specific pages of * results.
  • *
  • **Limiting Data Retrieval:** To prevent excessive data transfer and improve performance, * especially when dealing with large collections.
  • @@ -601,6 +612,7 @@ export class Pipeline implements ProtoSerializable { * *

    Example: * + * @example * ```typescript * // Limit the results to the top 10 highest-rated books * firestore.pipeline().collection('books') @@ -608,8 +620,8 @@ export class Pipeline implements ProtoSerializable { * .limit(10); * ``` * - * @param limit The maximum number of documents to return. - * @return A new Pipeline object with this stage appended to the stage list. + * @param limit - The maximum number of documents to return. + * @returns A new Pipeline object with this stage appended to the stage list. */ limit(limit: number): Pipeline; /** @@ -620,7 +632,7 @@ export class Pipeline implements ProtoSerializable { * a potentially large result set. It's often used for: * *

      - *
    • **Pagination:** In combination with {@link #offset} to retrieve specific pages of + *
    • **Pagination:** In combination with {@link @firebase/firestore/pipelines#Pipeline.offset} to retrieve specific pages of * results.
    • *
    • **Limiting Data Retrieval:** To prevent excessive data transfer and improve performance, * especially when dealing with large collections.
    • @@ -628,6 +640,7 @@ export class Pipeline implements ProtoSerializable { * *

      Example: * + * @example * ```typescript * // Limit the results to the top 10 highest-rated books * firestore.pipeline().collection('books') @@ -636,7 +649,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new Pipeline object with this stage appended to the stage list. + * @returns A new Pipeline object with this stage appended to the stage list. */ limit(options: LimitStageOptions): Pipeline; limit(limitOrOptions: number | LimitStageOptions): Pipeline { @@ -666,17 +679,18 @@ export class Pipeline implements ProtoSerializable { * Returns a set of distinct values from the inputs to this stage. * * This stage runs through the results from previous stages to include only results with - * unique combinations of {@link Expression} values ({@link Field}, {@link Function}, etc). + * unique combinations of {@link @firebase/firestore/pipelines#Expression} values ({@link @firebase/firestore/pipelines#Field}, {@link @firebase/firestore/pipelines#AliasedExpression}, etc). * - * The parameters to this stage are defined using {@link Selectable} expressions or strings: + * The parameters to this stage are defined using {@link @firebase/firestore/pipelines#Selectable} expressions or strings: * - * - {@code string}: Name of an existing field - * - {@link Field}: References an existing document field. - * - {@link AliasedExpr}: Represents the result of a function with an assigned alias name - * using {@link Expression#as}. + * - `string`: Name of an existing field + * - {@link @firebase/firestore/pipelines#Field}: References an existing document field. + * - {@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name + * using {@link @firebase/firestore/pipelines#Expression.(as:1)}. * * Example: * + * @example * ```typescript * // Get a list of unique author names in uppercase and genre combinations. * firestore.pipeline().collection("books") @@ -684,11 +698,11 @@ export class Pipeline implements ProtoSerializable { * .select("authorName"); * ``` * - * @param group The {@link Selectable} expression or field name to consider when determining + * @param group - The {@link @firebase/firestore/pipelines#Selectable} expression or field name to consider when determining * distinct value combinations. - * @param additionalGroups Optional additional {@link Selectable} expressions to consider when determining distinct + * @param additionalGroups - Optional additional {@link @firebase/firestore/pipelines#Selectable} expressions to consider when determining distinct * value combinations or strings representing field names. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ distinct( group: string | Selectable, @@ -699,17 +713,18 @@ export class Pipeline implements ProtoSerializable { * Returns a set of distinct values from the inputs to this stage. * * This stage runs through the results from previous stages to include only results with - * unique combinations of {@link Expression} values ({@link Field}, {@link Function}, etc). + * unique combinations of {@link @firebase/firestore/pipelines#Expression} values ({@link @firebase/firestore/pipelines#Field}, {@link @firebase/firestore/pipelines#AliasedExpression}, etc). * - * The parameters to this stage are defined using {@link Selectable} expressions or strings: + * The parameters to this stage are defined using {@link @firebase/firestore/pipelines#Selectable} expressions or strings: * - * - {@code string}: Name of an existing field - * - {@link Field}: References an existing document field. - * - {@link AliasedExpr}: Represents the result of a function with an assigned alias name - * using {@link Expression#as}. + * - `string`: Name of an existing field + * - {@link @firebase/firestore/pipelines#Field}: References an existing document field. + * - {@link @firebase/firestore/pipelines#AliasedExpression}: Represents the result of a function with an assigned alias name + * using {@link @firebase/firestore/pipelines#Expression.(as:1)}. * * Example: * + * @example * ```typescript * // Get a list of unique author names in uppercase and genre combinations. * firestore.pipeline().collection("books") @@ -718,7 +733,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ distinct(options: DistinctStageOptions): Pipeline; distinct( @@ -758,11 +773,12 @@ export class Pipeline implements ProtoSerializable { * Performs aggregation operations on the documents from previous stages. * *

      This stage allows you to calculate aggregate values over a set of documents. You define the - * aggregations to perform using {@link AliasedAggregate} expressions which are typically results of - * calling {@link Expression#as} on {@link AggregateFunction} instances. + * aggregations to perform using {@link @firebase/firestore/pipelines#AliasedAggregate} expressions which are typically results of + * calling {@link @firebase/firestore/pipelines#Expression.(as:1)} on {@link @firebase/firestore/pipelines#AggregateFunction} instances. * *

      Example: * + * @example * ```typescript * // Calculate the average rating and the total number of books * firestore.pipeline().collection("books") @@ -772,11 +788,11 @@ export class Pipeline implements ProtoSerializable { * ); * ``` * - * @param accumulator The first {@link AliasedAggregate}, wrapping an {@link AggregateFunction} + * @param accumulator - The first {@link @firebase/firestore/pipelines#AliasedAggregate}, wrapping an {@link @firebase/firestore/pipelines#AggregateFunction} * and providing a name for the accumulated results. - * @param additionalAccumulators Optional additional {@link AliasedAggregate}, each wrapping an {@link AggregateFunction} + * @param additionalAccumulators - Optional additional {@link @firebase/firestore/pipelines#AliasedAggregate}, each wrapping an {@link @firebase/firestore/pipelines#AggregateFunction} * and providing a name for the accumulated results. - * @return A new Pipeline object with this stage appended to the stage list. + * @returns A new Pipeline object with this stage appended to the stage list. */ aggregate( accumulator: AliasedAggregate, @@ -795,13 +811,14 @@ export class Pipeline implements ProtoSerializable { * If no grouping fields are provided, a single group containing all documents is used. Not * specifying groups is the same as putting the entire inputs into one group. *

    • **Accumulators:** One or more accumulation operations to perform within each group. These - * are defined using {@link AliasedAggregate} expressions, which are typically created by - * calling {@link Expression#as} on {@link AggregateFunction} instances. Each aggregation + * are defined using {@link @firebase/firestore/pipelines#AliasedAggregate} expressions, which are typically created by + * calling {@link @firebase/firestore/pipelines#Expression.(as:1)} on {@link @firebase/firestore/pipelines#AggregateFunction} instances. Each aggregation * calculates a value (e.g., sum, average, count) based on the documents within its group.
    • *
    * *

    Example: * + * @example * ```typescript * // Calculate the average rating for each genre. * firestore.pipeline().collection("books") @@ -812,7 +829,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage * list. */ aggregate(options: AggregateStageOptions): Pipeline; @@ -879,7 +896,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ findNearest(options: FindNearestStageOptions): Pipeline { // Convert user land convenience types to internal types @@ -916,16 +933,17 @@ export class Pipeline implements ProtoSerializable { /** * @beta - * Sorts the documents from previous stages based on one or more {@link Ordering} criteria. + * Sorts the documents from previous stages based on one or more {@link @firebase/firestore/pipelines#Ordering} criteria. * *

    This stage allows you to order the results of your pipeline. You can specify multiple {@link - * Ordering} instances to sort by multiple fields in ascending or descending order. If documents + * @firebase/firestore/pipelines#Ordering} instances to sort by multiple fields in ascending or descending order. If documents * have the same value for a field used for sorting, the next specified ordering will be used. If * all orderings result in equal comparison, the documents are considered equal and the order is * unspecified. * *

    Example: * + * @example * ```typescript * // Sort books by rating in descending order, and then by title in ascending order for books * // with the same rating @@ -936,23 +954,24 @@ export class Pipeline implements ProtoSerializable { * ); * ``` * - * @param ordering The first {@link Ordering} instance specifying the sorting criteria. - * @param additionalOrderings Optional additional {@link Ordering} instances specifying the additional sorting criteria. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @param ordering - The first {@link @firebase/firestore/pipelines#Ordering} instance specifying the sorting criteria. + * @param additionalOrderings - Optional additional {@link @firebase/firestore/pipelines#Ordering} instances specifying the additional sorting criteria. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ sort(ordering: Ordering, ...additionalOrderings: Ordering[]): Pipeline; /** * @beta - * Sorts the documents from previous stages based on one or more {@link Ordering} criteria. + * Sorts the documents from previous stages based on one or more {@link @firebase/firestore/pipelines#Ordering} criteria. * *

    This stage allows you to order the results of your pipeline. You can specify multiple {@link - * Ordering} instances to sort by multiple fields in ascending or descending order. If documents + * @firebase/firestore/pipelines#Ordering} instances to sort by multiple fields in ascending or descending order. If documents * have the same value for a field used for sorting, the next specified ordering will be used. If * all orderings result in equal comparison, the documents are considered equal and the order is * unspecified. * *

    Example: * + * @example * ```typescript * // Sort books by rating in descending order, and then by title in ascending order for books * // with the same rating @@ -964,7 +983,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ sort(options: SortStageOptions): Pipeline; sort( @@ -1001,6 +1020,7 @@ export class Pipeline implements ProtoSerializable { * *

    Example: * + * @example * ```typescript * // Input. * // { @@ -1021,8 +1041,8 @@ export class Pipeline implements ProtoSerializable { * // } * ``` * - * @param fieldName The {@link Field} field containing the nested map. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @param fieldName - The {@link @firebase/firestore/pipelines#Field} field containing the nested map. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ replaceWith(fieldName: string): Pipeline; /** @@ -1034,6 +1054,7 @@ export class Pipeline implements ProtoSerializable { * *

    Example: * + * @example * ```typescript * // Input. * // { @@ -1059,8 +1080,8 @@ export class Pipeline implements ProtoSerializable { * // } * ``` * - * @param expr An {@link Expression} that when returned evaluates to a map. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @param expr - An {@link @firebase/firestore/pipelines#Expression} that when returned evaluates to a map. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ replaceWith(expr: Expression): Pipeline; /** @@ -1072,6 +1093,7 @@ export class Pipeline implements ProtoSerializable { * *

    Example: * + * @example * ```typescript * // Input. * // { @@ -1098,7 +1120,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ replaceWith(options: ReplaceWithStageOptions): Pipeline; replaceWith( @@ -1139,14 +1161,15 @@ export class Pipeline implements ProtoSerializable { * *

    Examples: * + * @example * ```typescript * // Sample 25 books, if available. * firestore.pipeline().collection('books') * .sample(25); * ``` * - * @param documents The number of documents to sample. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @param documents - The number of documents to sample. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ sample(documents: number): Pipeline; @@ -1155,10 +1178,10 @@ export class Pipeline implements ProtoSerializable { * Performs a pseudo-random sampling of the documents from the previous stage. * *

    This stage will filter documents pseudo-randomly. The 'options' parameter specifies how - * sampling will be performed. See {@code SampleOptions} for more information. - * - *

    Examples: + * sampling will be performed. See {@link @firebase/firestore/pipelines#SampleStageOptions} for more information. * + * @example + * ```typescript * // Sample 10 books, if available. * firestore.pipeline().collection("books") * .sample({ documents: 10 }); @@ -1166,9 +1189,10 @@ export class Pipeline implements ProtoSerializable { * // Sample 50% of books. * firestore.pipeline().collection("books") * .sample({ percentage: 0.5 }); + * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ sample(options: SampleStageOptions): Pipeline; sample(documentsOrOptions: number | SampleStageOptions): Pipeline { @@ -1207,19 +1231,20 @@ export class Pipeline implements ProtoSerializable { * Performs union of all documents from two pipelines, including duplicates. * *

    This stage will pass through documents from previous stage, and also pass through documents - * from previous stage of the `other` {@code Pipeline} given in parameter. The order of documents + * from previous stage of the `other` {@link @firebase/firestore/pipelines#Pipeline} given in parameter. The order of documents * emitted from this stage is undefined. * *

    Example: * + * @example * ```typescript * // Emit documents from books collection and magazines collection. * firestore.pipeline().collection('books') * .union(firestore.pipeline().collection('magazines')); * ``` * - * @param other The other {@code Pipeline} that is part of union. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @param other - The other {@link @firebase/firestore/pipelines#Pipeline} that is part of union. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ union(other: Pipeline): Pipeline; /** @@ -1227,11 +1252,12 @@ export class Pipeline implements ProtoSerializable { * Performs union of all documents from two pipelines, including duplicates. * *

    This stage will pass through documents from previous stage, and also pass through documents - * from previous stage of the `other` {@code Pipeline} given in parameter. The order of documents + * from previous stage of the `other` {@link @firebase/firestore/pipelines#Pipeline} given in parameter. The order of documents * emitted from this stage is undefined. * *

    Example: * + * @example * ```typescript * // Emit documents from books collection and magazines collection. * firestore.pipeline().collection('books') @@ -1239,7 +1265,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ union(options: UnionStageOptions): Pipeline; union(otherOrOptions: Pipeline | UnionStageOptions): Pipeline { @@ -1283,6 +1309,7 @@ export class Pipeline implements ProtoSerializable { * * Example: * + * @example * ```typescript * // Input: * // { "title": "The Hitchhiker's Guide to the Galaxy", "tags": [ "comedy", "space", "adventure" ], ... } @@ -1297,9 +1324,9 @@ export class Pipeline implements ProtoSerializable { * // { "title": "The Hitchhiker's Guide to the Galaxy", "tag": "adventure", "tagIndex": 2, ... } * ``` * - * @param selectable A selectable expression defining the field to unnest and the alias to use for each un-nested element in the output documents. - * @param indexField An optional string value specifying the field path to write the offset (starting at zero) into the array the un-nested element is from - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @param selectable - A selectable expression defining the field to unnest and the alias to use for each un-nested element in the output documents. + * @param indexField - An optional string value specifying the field path to write the offset (starting at zero) into the array the un-nested element is from + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ unnest(selectable: Selectable, indexField?: string): Pipeline; /** @@ -1317,6 +1344,7 @@ export class Pipeline implements ProtoSerializable { * * Example: * + * @example * ```typescript * // Input: * // { "title": "The Hitchhiker's Guide to the Galaxy", "tags": [ "comedy", "space", "adventure" ], ... } @@ -1332,7 +1360,7 @@ export class Pipeline implements ProtoSerializable { * ``` * * @param options - An object that specifies required and optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ unnest(options: UnnestStageOptions): Pipeline; unnest( @@ -1387,6 +1415,7 @@ export class Pipeline implements ProtoSerializable { * *

    Example (Assuming there is no 'where' stage available in SDK): * + * @example * ```typescript * // Assume we don't have a built-in 'where' stage * firestore.pipeline().collection('books') @@ -1397,7 +1426,7 @@ export class Pipeline implements ProtoSerializable { * @param name - The unique name of the raw stage to add. * @param params - A list of parameters to configure the raw stage's behavior. * @param options - An object of key value pairs that specifies optional parameters for the stage. - * @return A new {@code Pipeline} object with this stage appended to the stage list. + * @returns A new {@link @firebase/firestore/pipelines#Pipeline} object with this stage appended to the stage list. */ rawStage( name: string, diff --git a/packages/firestore/src/lite-api/pipeline_impl.ts b/packages/firestore/src/lite-api/pipeline_impl.ts index dbfe96a099..fa0d480221 100644 --- a/packages/firestore/src/lite-api/pipeline_impl.ts +++ b/packages/firestore/src/lite-api/pipeline_impl.ts @@ -39,7 +39,7 @@ declare module './database' { interface Firestore { /** * @beta - * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link Pipeline}. + * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link @firebase/firestore/pipelines#Pipeline}. * * @example * ``` @@ -57,23 +57,22 @@ declare module './database' { * The returned Promise can be used to track the progress of the pipeline execution * and retrieve the results (or handle any errors) asynchronously. * - * The pipeline results are returned as a {@link PipelineSnapshot} that contains - * a list of {@link PipelineResult} objects. Each {@link PipelineResult} typically + * The pipeline results are returned as a {@link @firebase/firestore/pipelines#PipelineSnapshot} that contains + * a list of {@link @firebase/firestore/pipelines#PipelineResult} objects. Each {@link @firebase/firestore/pipelines#PipelineResult} typically * represents a single key/value map that has passed through all the * stages of the pipeline, however this might differ depending on the stages involved in the * pipeline. For example: * *

      - *
    • If there are no stages or only transformation stages, each {@link PipelineResult} + *
    • If there are no stages or only transformation stages, each {@link @firebase/firestore/pipelines#PipelineResult} * represents a single document.
    • - *
    • If there is an aggregation, only a single {@link PipelineResult} is returned, + *
    • If there is an aggregation, only a single {@link @firebase/firestore/pipelines#PipelineResult} is returned, * representing the aggregated results over the entire dataset .
    • - *
    • If there is an aggregation stage with grouping, each {@link PipelineResult} represents a + *
    • If there is an aggregation stage with grouping, each {@link @firebase/firestore/pipelines#PipelineResult} represents a * distinct group and its associated aggregated values.
    • *
    * - *

    Example: - * + * @example * ```typescript * const snapshot: PipelineSnapshot = await execute(firestore.pipeline().collection("books") * .where(gt(field("rating"), 4.5)) @@ -82,8 +81,8 @@ declare module './database' { * const results: PipelineResults = snapshot.results; * ``` * - * @param pipeline The pipeline to execute. - * @return A Promise representing the asynchronous pipeline execution. + * @param pipeline - The pipeline to execute. + * @returns A Promise representing the asynchronous pipeline execution. */ export function execute(pipeline: Pipeline): Promise { const datastore = getDatastore(pipeline._db); @@ -132,7 +131,7 @@ export function execute(pipeline: Pipeline): Promise { /** * @beta - * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link Pipeline}. + * Creates and returns a new PipelineSource, which allows specifying the source stage of a {@link @firebase/firestore/pipelines#Pipeline}. * * @example * ``` diff --git a/packages/firestore/src/lite-api/pipeline_options.ts b/packages/firestore/src/lite-api/pipeline_options.ts index c46f42c856..8f8f9d6238 100644 --- a/packages/firestore/src/lite-api/pipeline_options.ts +++ b/packages/firestore/src/lite-api/pipeline_options.ts @@ -50,6 +50,7 @@ export interface PipelineExecuteOptions { * Values specified in rawOptions will take precedence over any options * with the same name set by the SDK. * + * @example * Override the `example_option`: * ``` * execute({ diff --git a/packages/firestore/src/lite-api/reference.ts b/packages/firestore/src/lite-api/reference.ts index 43eedecf8b..51bd24fefa 100644 --- a/packages/firestore/src/lite-api/reference.ts +++ b/packages/firestore/src/lite-api/reference.ts @@ -305,7 +305,7 @@ export class DocumentReference< * {@link DocumentReference.toJSON}. * * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. - * @param json a JSON object represention of a `DocumentReference` instance + * @param json - a JSON object represention of a `DocumentReference` instance * @returns an instance of {@link DocumentReference} if the JSON object could be parsed. Throws a * {@link FirestoreError} if an error occurs. */ @@ -315,7 +315,7 @@ export class DocumentReference< * {@link DocumentReference.toJSON}. * * @param firestore - The {@link Firestore} instance the snapshot should be loaded for. - * @param json a JSON object represention of a `DocumentReference` instance + * @param json - a JSON object represention of a `DocumentReference` instance * @param converter - Converts objects to and from Firestore. * @returns an instance of {@link DocumentReference} if the JSON object could be parsed. Throws a * {@link FirestoreError} if an error occurs. diff --git a/packages/firestore/src/lite-api/stage.ts b/packages/firestore/src/lite-api/stage.ts index 5dd30eedba..1cca37d4f6 100644 --- a/packages/firestore/src/lite-api/stage.ts +++ b/packages/firestore/src/lite-api/stage.ts @@ -745,9 +745,9 @@ export class RawStage extends Stage { /** * Helper to read user data across a number of different formats. - * @param name Name of the calling function. Used for error messages when invalid user data is encountered. + * @param name - Name of the calling function. Used for error messages when invalid user data is encountered. * @param expressionMap - * @return the expressionMap argument. + * @returns the expressionMap argument. * @private */ function readUserDataHelper< diff --git a/packages/firestore/src/lite-api/stage_options.ts b/packages/firestore/src/lite-api/stage_options.ts index ea9ff08823..ba53580bd1 100644 --- a/packages/firestore/src/lite-api/stage_options.ts +++ b/packages/firestore/src/lite-api/stage_options.ts @@ -59,7 +59,7 @@ export interface StageOptions { } /** * @beta - * Options defining how a CollectionStage is evaluated. See {@link PipelineSource.collection}. + * Options defining how a CollectionStage is evaluated. See {@link @firebase/firestore/pipelines#PipelineSource.(collection:1)}. */ export type CollectionStageOptions = StageOptions & { /** @@ -81,11 +81,11 @@ export type CollectionStageOptions = StageOptions & { /** * @beta - * Defines the configuration options for a {@link CollectionGroupStage} within a pipeline. - * This type extends {@link StageOptions} and provides specific settings for how a collection group + * Defines the configuration options for a CollectionGroupStage within a pipeline. + * This type extends {@link @firebase/firestore/pipelines#StageOptions} and provides specific settings for how a collection group * is identified and processed during pipeline execution. * - * @see {@link PipelineSource.collectionGroup} to create a collection group stage. + * See {@link @firebase/firestore/pipelines#PipelineSource.(collectionGroup:1)} to create a collection group stage. */ export type CollectionGroupStageOptions = StageOptions & { /** @@ -106,12 +106,12 @@ export type CollectionGroupStageOptions = StageOptions & { }; /** * @beta - * Options defining how a DatabaseStage is evaluated. See {@link PipelineSource.database}. + * Options defining how a DatabaseStage is evaluated. See {@link @firebase/firestore/pipelines#PipelineSource.(database:1)}. */ export type DatabaseStageOptions = StageOptions & {}; /** * @beta - * Options defining how a DocumentsStage is evaluated. See {@link PipelineSource.documents}. + * Options defining how a DocumentsStage is evaluated. See {@link @firebase/firestore/pipelines#PipelineSource.(documents:1)}. */ export type DocumentsStageOptions = StageOptions & { /** @@ -124,19 +124,19 @@ export type DocumentsStageOptions = StageOptions & { }; /** * @beta - * Options defining how an AddFieldsStage is evaluated. See {@link Pipeline.addFields}. + * Options defining how an AddFieldsStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(addFields:1)}. */ export type AddFieldsStageOptions = StageOptions & { /** * @beta - * The fields to add to each document, specified as a {@link Selectable}. + * The fields to add to each document, specified as a {@link @firebase/firestore/pipelines#Selectable}. * At least one field is required. */ fields: Selectable[]; }; /** * @beta - * Options defining how a RemoveFieldsStage is evaluated. See {@link Pipeline.removeFields}. + * Options defining how a RemoveFieldsStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(removeFields:1)}. */ export type RemoveFieldsStageOptions = StageOptions & { /** @@ -147,30 +147,30 @@ export type RemoveFieldsStageOptions = StageOptions & { }; /** * @beta - * Options defining how a SelectStage is evaluated. See {@link Pipeline.select}. + * Options defining how a SelectStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(select:1)}. */ export type SelectStageOptions = StageOptions & { /** * @beta - * The fields to include in the output documents, specified as {@link Selectable} expression + * The fields to include in the output documents, specified as {@link @firebase/firestore/pipelines#Selectable} expression * or as a string value indicating the field name. */ selections: Array; }; /** * @beta - * Options defining how a WhereStage is evaluated. See {@link Pipeline.where}. + * Options defining how a WhereStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(where:1)}. */ export type WhereStageOptions = StageOptions & { /** * @beta - * The {@link BooleanExpression} to apply as a filter for each input document to this stage. + * The {@link @firebase/firestore/pipelines#BooleanExpression} to apply as a filter for each input document to this stage. */ condition: BooleanExpression; }; /** * @beta - * Options defining how an OffsetStage is evaluated. See {@link Pipeline.offset}. + * Options defining how an OffsetStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(offset:1)}. */ export type OffsetStageOptions = StageOptions & { /** @@ -181,7 +181,7 @@ export type OffsetStageOptions = StageOptions & { }; /** * @beta - * Options defining how a LimitStage is evaluated. See {@link Pipeline.limit}. + * Options defining how a LimitStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(limit:1)}. */ export type LimitStageOptions = StageOptions & { /** @@ -192,12 +192,12 @@ export type LimitStageOptions = StageOptions & { }; /** * @beta - * Options defining how a DistinctStage is evaluated. See {@link Pipeline.distinct}. + * Options defining how a DistinctStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(distinct:1)}. */ export type DistinctStageOptions = StageOptions & { /** * @beta - * The {@link Selectable} expressions or field names to consider when determining + * The {@link @firebase/firestore/pipelines#Selectable} expressions or field names to consider when determining * distinct value combinations (groups). */ groups: Array; @@ -205,31 +205,31 @@ export type DistinctStageOptions = StageOptions & { /** * @beta - * Options defining how an AggregateStage is evaluated. See {@link Pipeline.aggregate}. + * Options defining how an AggregateStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(aggregate:1)}. */ export type AggregateStageOptions = StageOptions & { /** * @beta - * The {@link AliasedAggregate} values specifying aggregate operations to + * The {@link @firebase/firestore/pipelines#AliasedAggregate} values specifying aggregate operations to * perform on the input documents. */ accumulators: AliasedAggregate[]; /** * @beta - * The {@link Selectable} expressions or field names to consider when determining + * The {@link @firebase/firestore/pipelines#Selectable} expressions or field names to consider when determining * distinct value combinations (groups), which will be aggregated over. */ groups?: Array; }; /** * @beta - * Options defining how a FindNearestStage is evaluated. See {@link Pipeline.findNearest}. + * Options defining how a FindNearestStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(findNearest:1)}. */ export type FindNearestStageOptions = StageOptions & { /** * @beta * Specifies the field to be used. This can be a string representing the field path - * (e.g., 'fieldName', 'nested.fieldName') or an object of type {@link Field} + * (e.g., 'fieldName', 'nested.fieldName') or an object of type {@link @firebase/firestore/pipelines#Field} * representing a more complex field expression. */ field: Field | string; @@ -263,12 +263,12 @@ export type FindNearestStageOptions = StageOptions & { }; /** * @beta - * Options defining how a ReplaceWithStage is evaluated. See {@link Pipeline.replaceWith}. + * Options defining how a ReplaceWithStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(replaceWith:1)}. */ export type ReplaceWithStageOptions = StageOptions & { /** * @beta - * The name of a field that contains a map or an {@link Expression} that + * The name of a field that contains a map or an {@link @firebase/firestore/pipelines#Expression} that * evaluates to a map. */ map: Expression | string; @@ -276,10 +276,10 @@ export type ReplaceWithStageOptions = StageOptions & { /** * @beta * Defines the options for evaluating a sample stage within a pipeline. - * This type combines common {@link StageOptions} with a specific configuration + * This type combines common {@link @firebase/firestore/pipelines#StageOptions} with a specific configuration * where only one of the defined sampling methods can be applied. * - * See {@link Pipeline.sample} to create a sample stage.. + * See {@link @firebase/firestore/pipelines#Pipeline.(sample:1)} to create a sample stage.. */ export type SampleStageOptions = StageOptions & OneOf<{ @@ -302,7 +302,7 @@ export type SampleStageOptions = StageOptions & }>; /** * @beta - * Options defining how a UnionStage is evaluated. See {@link Pipeline.union}. + * Options defining how a UnionStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(union:1)}. */ export type UnionStageOptions = StageOptions & { /** @@ -333,7 +333,7 @@ export type UnnestStageOptions = StageOptions & { /** * @beta * @beta - * Options defining how a SortStage is evaluated. See {@link Pipeline.sort}. + * Options defining how a SortStage is evaluated. See {@link @firebase/firestore/pipelines#Pipeline.(sort:1)}. */ export type SortStageOptions = StageOptions & { /** diff --git a/packages/firestore/src/lite-api/vector_value.ts b/packages/firestore/src/lite-api/vector_value.ts index c48feaeff3..96bf9d5fe5 100644 --- a/packages/firestore/src/lite-api/vector_value.ts +++ b/packages/firestore/src/lite-api/vector_value.ts @@ -24,8 +24,6 @@ import { Property, property, validateJSON } from '../util/json_validation'; /** * Represents a vector type in Firestore documents. * Create an instance with {@link vector}. - * - * @class VectorValue */ export class VectorValue { private readonly _values: number[]; @@ -74,7 +72,7 @@ export class VectorValue { /** * Builds a `VectorValue` instance from a JSON object created by {@link VectorValue.toJSON}. * - * @param json a JSON object represention of a `VectorValue` instance. + * @param json - a JSON object represention of a `VectorValue` instance. * @returns an instance of {@link VectorValue} if the JSON object could be parsed. Throws a * {@link FirestoreError} if an error occurs. */ diff --git a/packages/firestore/src/local/document_overlay_cache.ts b/packages/firestore/src/local/document_overlay_cache.ts index 8cfb5412d5..471b1b7538 100644 --- a/packages/firestore/src/local/document_overlay_cache.ts +++ b/packages/firestore/src/local/document_overlay_cache.ts @@ -96,7 +96,7 @@ export interface DocumentOverlayCache { * Only overlays that contain a change past `sinceBatchId` are returned. * @param count - The number of overlays to return. Can be exceeded if the last * batch contains more entries. - * @return Mapping of each document key in the collection group to its overlay. + * @returns Mapping of each document key in the collection group to its overlay. */ getOverlaysForCollectionGroup( transaction: PersistenceTransaction, diff --git a/packages/firestore/src/local/index_manager.ts b/packages/firestore/src/local/index_manager.ts index d81693acc6..e0ab95f19a 100644 --- a/packages/firestore/src/local/index_manager.ts +++ b/packages/firestore/src/local/index_manager.ts @@ -120,9 +120,9 @@ export interface IndexManager { * Returns a list of field indexes that correspond to the specified collection * group. * - * @param collectionGroup The collection group to get matching field indexes + * @param collectionGroup - The collection group to get matching field indexes * for. - * @return A collection of field indexes for the specified collection group. + * @returns A collection of field indexes for the specified collection group. */ getFieldIndexes( transaction: PersistenceTransaction, diff --git a/packages/firestore/src/local/local_documents_view.ts b/packages/firestore/src/local/local_documents_view.ts index fa64ed76eb..5010e9b800 100644 --- a/packages/firestore/src/local/local_documents_view.ts +++ b/packages/firestore/src/local/local_documents_view.ts @@ -210,7 +210,7 @@ export class LocalDocumentsView { * @param existenceStateChanged - A set of documents whose existence states * might have changed. This is used to determine if we need to re-calculate * overlays from mutation queues. - * @return A map represents the local documents view. + * @returns A map represents the local documents view. */ computeViews( transaction: PersistenceTransaction, @@ -394,10 +394,10 @@ export class LocalDocumentsView { * returned together, the total number of documents returned can exceed {@code count}. * * @param transaction - * @param collectionGroup The collection group for the documents. - * @param offset The offset to index into. - * @param count The number of documents to return - * @return A LocalWriteResult with the documents that follow the provided offset and the last processed batch id. + * @param collectionGroup - The collection group for the documents. + * @param offset - The offset to index into. + * @param count - The number of documents to return + * @returns A LocalWriteResult with the documents that follow the provided offset and the last processed batch id. */ getNextDocuments( transaction: PersistenceTransaction, diff --git a/packages/firestore/src/local/shared_client_state.ts b/packages/firestore/src/local/shared_client_state.ts index 1000e63a0f..5829d5ee8d 100644 --- a/packages/firestore/src/local/shared_client_state.ts +++ b/packages/firestore/src/local/shared_client_state.ts @@ -182,7 +182,7 @@ export interface SharedClientState { * Notifies other clients when remote documents have changed due to loading * a bundle. * - * @param collectionGroups The collection groups affected by this bundle. + * @param collectionGroups - The collection groups affected by this bundle. */ notifyBundleLoaded(collectionGroups: Set): void; } diff --git a/packages/firestore/src/util/array.ts b/packages/firestore/src/util/array.ts index 3427abcf67..9695ae1cb4 100644 --- a/packages/firestore/src/util/array.ts +++ b/packages/firestore/src/util/array.ts @@ -117,9 +117,9 @@ export function diffArrays( * * @private * @internal - * @param left Array of objects supporting `isEqual`. - * @param right Array of objects supporting `isEqual`. - * @return True if arrays are equal. + * @param left - Array of objects supporting `isEqual`. + * @param right - Array of objects supporting `isEqual`. + * @returns True if arrays are equal. */ export function isArrayEqual boolean }>( left: T[], @@ -143,9 +143,9 @@ export function isArrayEqual boolean }>( * * @private * @internal - * @param left Array of primitives. - * @param right Array of primitives. - * @return True if arrays are equal. + * @param left - Array of primitives. + * @param right - Array of primitives. + * @returns True if arrays are equal. */ export function isPrimitiveArrayEqual( left: T[], diff --git a/packages/firestore/src/util/assert.ts b/packages/firestore/src/util/assert.ts index 07ebe775e9..7c9c570695 100644 --- a/packages/firestore/src/util/assert.ts +++ b/packages/firestore/src/util/assert.ts @@ -27,7 +27,7 @@ import { logError } from './log'; * @example * let futureVar = fail('not implemented yet'); * - * @param code generate a new unique value with `yarn assertion-id:generate` + * @param code - generate a new unique value with `yarn assertion-id:generate` * Search for an existing value using `yarn assertion-id:find X` */ export function fail( @@ -44,7 +44,7 @@ export function fail( * @example * let futureVar = fail('not implemented yet'); * - * @param id generate a new unique value with `yarn assertion-id:generate` + * @param id - generate a new unique value with `yarn assertion-id:generate` * Search for an existing value using `yarn assertion-id:find X` */ export function fail(id: number, context?: Record): never; @@ -95,7 +95,7 @@ function _fail( * * Messages are stripped in production builds. * - * @param id generate a new unique value with `yarn assertion-idgenerate`. + * @param id - generate a new unique value with `yarn assertion-idgenerate`. * Search for an existing value using `yarn assertion-id:find X` */ export function hardAssert( @@ -111,7 +111,7 @@ export function hardAssert( * * Messages are stripped in production builds. * - * @param id generate a new unique value with `yarn assertion-id:generate`. + * @param id - generate a new unique value with `yarn assertion-id:generate`. * Search for an existing value using `yarn assertion-id:find X` */ export function hardAssert( diff --git a/packages/firestore/src/util/async_queue.ts b/packages/firestore/src/util/async_queue.ts index 09171a9f03..2d07ffb815 100644 --- a/packages/firestore/src/util/async_queue.ts +++ b/packages/firestore/src/util/async_queue.ts @@ -235,7 +235,7 @@ export interface AsyncQueue { * only possible way to request running an operation is through * `enqueueEvenWhileRestricted()`. * - * @param purgeExistingTasks Whether already enqueued tasked should be + * @param purgeExistingTasks - Whether already enqueued tasked should be * rejected (unless enqueued with `enqueueEvenWhileRestricted()`). Defaults * to false. */ diff --git a/packages/firestore/src/util/bundle_builder_impl.ts b/packages/firestore/src/util/bundle_builder_impl.ts index dc94ebca49..a57d53f130 100644 --- a/packages/firestore/src/util/bundle_builder_impl.ts +++ b/packages/firestore/src/util/bundle_builder_impl.ts @@ -86,10 +86,10 @@ export class BundleBuilder { /** * Adds data from a DocumentSnapshot to the bundle. * @internal - * @param docBundleData A DocumentSnapshotBundleData containing information from the + * @param docBundleData - A DocumentSnapshotBundleData containing information from the * DocumentSnapshot. Note we cannot accept a DocumentSnapshot directly due to a circular * dependency error. - * @param queryName The name of the QuerySnapshot if this document is part of a Query. + * @param queryName - The name of the QuerySnapshot if this document is part of a Query. */ addBundleDocument( docBundleData: DocumentSnapshotBundleData, @@ -134,7 +134,7 @@ export class BundleBuilder { /** * Adds data from a QuerySnapshot to the bundle. * @internal - * @param docBundleData A QuerySnapshotBundleData containing information from the + * @param docBundleData - A QuerySnapshotBundleData containing information from the * QuerySnapshot. Note we cannot accept a QuerySnapshot directly due to a circular * dependency error. */ @@ -168,7 +168,7 @@ export class BundleBuilder { * Convert data from a DocumentSnapshot into the serialized form within a bundle. * @private * @internal - * @param docBundleData a DocumentSnapshotBundleData containing the data required to + * @param docBundleData - a DocumentSnapshotBundleData containing the data required to * serialize a document. */ private toBundleDocument( @@ -195,7 +195,7 @@ export class BundleBuilder { * of the element. * @private * @internal - * @param bundleElement A ProtoBundleElement that is expected to be Proto3 JSON compatible. + * @param bundleElement - A ProtoBundleElement that is expected to be Proto3 JSON compatible. */ private lengthPrefixedString(bundleElement: ProtoBundleElement): string { const str = JSON.stringify(bundleElement); diff --git a/packages/firestore/src/util/bundle_reader_sync_impl.ts b/packages/firestore/src/util/bundle_reader_sync_impl.ts index 9379bb5a5a..b1f0db2e44 100644 --- a/packages/firestore/src/util/bundle_reader_sync_impl.ts +++ b/packages/firestore/src/util/bundle_reader_sync_impl.ts @@ -80,7 +80,7 @@ export class BundleReaderSyncImpl implements BundleReaderSync { * Reads from a specified position from the bundleData string, for a specified * number of bytes. * - * @param length how many characters to read. + * @param length - how many characters to read. * @returns a string parsed from the bundle. */ private readJsonString(length: number): string { diff --git a/packages/firestore/src/util/debug_uid.ts b/packages/firestore/src/util/debug_uid.ts index d5dac6a134..da035fcf3c 100644 --- a/packages/firestore/src/util/debug_uid.ts +++ b/packages/firestore/src/util/debug_uid.ts @@ -49,7 +49,7 @@ function generateInitialUniqueDebugId(): number { * "debug ID" string in all of its log messages to help trace a specific * connection over time. * - * @return the 10-character generated ID (e.g. "0xa1b2c3d4"). + * @returns the 10-character generated ID (e.g. "0xa1b2c3d4"). */ export function generateUniqueDebugId(): string { if (lastUniqueDebugId === null) { diff --git a/packages/firestore/src/util/json_validation.ts b/packages/firestore/src/util/json_validation.ts index 771a7f91ef..b4bc4f6018 100644 --- a/packages/firestore/src/util/json_validation.ts +++ b/packages/firestore/src/util/json_validation.ts @@ -103,8 +103,8 @@ export function property( * @private * @internal * - * @param json A JSON object to validate. - * @param scheme a {@link JsonSchema} that defines the properties to validate. + * @param json - A JSON object to validate. + * @param scheme - a {@link JsonSchema} that defines the properties to validate. * @returns true if the JSON schema exists within the object. Throws a FirestoreError otherwise. */ export function validateJSON( diff --git a/packages/firestore/src/util/logic_utils.ts b/packages/firestore/src/util/logic_utils.ts index b2167c385e..f9fed07786 100644 --- a/packages/firestore/src/util/logic_utils.ts +++ b/packages/firestore/src/util/logic_utils.ts @@ -77,8 +77,8 @@ export function computeInExpansion(filter: Filter): Filter { * with two elements: a composite filter that performs (A && C), and a composite filter that * performs (B && C). * - * @param filter the composite filter to calculate DNF transform for. - * @return the terms in the DNF transform. + * @param filter - the composite filter to calculate DNF transform for. + * @returns the terms in the DNF transform. */ export function getDnfTerms(filter: CompositeFilter): Filter[] { if (filter.getFilters().length === 0) { diff --git a/packages/firestore/src/util/pipeline_util.ts b/packages/firestore/src/util/pipeline_util.ts index a7400828fd..d191e08e10 100644 --- a/packages/firestore/src/util/pipeline_util.ts +++ b/packages/firestore/src/util/pipeline_util.ts @@ -88,7 +88,7 @@ export function aliasedAggregateToMap( } /** - * Converts a value to an Expr, Returning either a Constant, MapFunction, + * Converts a value to an Expression, Returning either a Constant, MapFunction, * ArrayFunction, or the input itself (if it's already an expression). * * @private @@ -112,7 +112,7 @@ export function vectorToExpr( } /** - * Converts a value to an Expr, Returning either a Constant, MapFunction, + * Converts a value to an Expression, Returning either a Constant, MapFunction, * ArrayFunction, or the input itself (if it's already an expression). * If the input is a string, it is assumed to be a field name, and a * field(value) is returned. @@ -130,7 +130,7 @@ export function fieldOrExpression(value: unknown): Expression { } } /** - * Converts a value to an Expr, Returning either a Constant, MapFunction, + * Converts a value to an Expression, Returning either a Constant, MapFunction, * ArrayFunction, or the input itself (if it's already an expression). * * @private diff --git a/packages/firestore/src/util/testing_hooks.ts b/packages/firestore/src/util/testing_hooks.ts index 36422172a4..6c9aa955f7 100644 --- a/packages/firestore/src/util/testing_hooks.ts +++ b/packages/firestore/src/util/testing_hooks.ts @@ -43,9 +43,9 @@ export class TestingHooks { * rely on any particular ordering. If a given callback is registered multiple * times then it will be notified multiple times, once per registration. * - * @param callback the callback to invoke upon existence filter mismatch. + * @param callback - the callback to invoke upon existence filter mismatch. * - * @return a function that, when called, unregisters the given callback; only + * @returns a function that, when called, unregisters the given callback; only * the first invocation of the returned function does anything; all subsequent * invocations do nothing. */ diff --git a/packages/firestore/src/util/testing_hooks_spi.ts b/packages/firestore/src/util/testing_hooks_spi.ts index e6c729e366..3abcf50e3f 100644 --- a/packages/firestore/src/util/testing_hooks_spi.ts +++ b/packages/firestore/src/util/testing_hooks_spi.ts @@ -26,7 +26,7 @@ export let testingHooksSpi: TestingHooksSpi | null = null; /** * Sets the value of the `testingHooksSpi` object. - * @param instance the instance to set. + * @param instance - the instance to set. */ export function setTestingHooksSpi(instance: TestingHooksSpi): void { if (testingHooksSpi) { diff --git a/packages/firestore/src/util/types.ts b/packages/firestore/src/util/types.ts index ad272991ff..b5dd09fbbc 100644 --- a/packages/firestore/src/util/types.ts +++ b/packages/firestore/src/util/types.ts @@ -79,10 +79,13 @@ export interface DocumentLike { * Utility type to create an type that only allows one * property of the Type param T to be set. * - * type XorY = OneOf<{ x: unknown, y: unknown}> + * @example + * ``` + * type XorY = OneOf<{ x: unknown, y: unknown }> * let a = { x: "foo" } // OK * let b = { y: "foo" } // OK * let c = { a: "foo", y: "foo" } // Not OK + * ``` */ export type OneOf = { [K in keyof T]: Pick & {