@@ -1328,6 +1328,7 @@ describe("firestore-pipelines", () => {
13281328 const {
13291329 Firestore,
13301330 Timestamp,
1331+ addDoc,
13311332 collection,
13321333 doc,
13331334 getFirestore,
@@ -3399,6 +3400,15 @@ describe("firestore-pipelines", () => {
33993400 console . log ( result ) ;
34003401 }
34013402
3403+ async function defineStageData ( ) {
3404+ // [START define_stage_data]
3405+ await setDoc ( doc ( collection ( db , "Authors" ) , "author_123" ) , {
3406+ "id" : "author_123" ,
3407+ "name" : "Jane Austen"
3408+ } ) ;
3409+ // [END define_stage_data]
3410+ }
3411+
34023412 // https://firebase.google.com/docs/firestore/pipelines/perform-joins-with-sub-pipelines
34033413 async function defineStage ( ) {
34043414 // [START define_example]
@@ -3420,6 +3430,23 @@ describe("firestore-pipelines", () => {
34203430 console . log ( result ) ;
34213431 }
34223432
3433+ async function toArrayExpressionStageData ( ) {
3434+ // [START to_array_expression_stage_data]
3435+ await setDoc ( doc ( collection ( db , "Projects" ) , "project_1" ) , {
3436+ "id" : "project_1" ,
3437+ "name" : "Alpha Build"
3438+ } ) ;
3439+ await addDoc ( collection ( db , "Tasks" ) , {
3440+ "project_id" : "project_1" ,
3441+ "title" : "System Architecture"
3442+ } ) ;
3443+ await addDoc ( collection ( db , "Tasks" ) , {
3444+ "project_id" : "project_1" ,
3445+ "title" : "Database Schema Design"
3446+ } ) ;
3447+ // [END to_array_expression_stage_data]
3448+ }
3449+
34233450 // https://firebase.google.com/docs/firestore/pipelines/perform-joins-with-sub-pipelines
34243451 async function toArrayExpressionStage ( ) {
34253452 // [START to_array_expression]
@@ -3438,6 +3465,25 @@ describe("firestore-pipelines", () => {
34383465 console . log ( projectTasks ) ;
34393466 }
34403467
3468+ async function toScalarExpressionStageData ( ) {
3469+ // [START to_scalar_expression_stage_data]
3470+ await setDoc ( doc ( collection ( db , "Authors" ) , "author_202" ) , {
3471+ "id" : "author_202" ,
3472+ "name" : "Charles Dickens"
3473+ } ) ;
3474+ await addDoc ( collection ( db , "Books" ) , {
3475+ "author_id" : "author_202" ,
3476+ "title" : "Great Expectations" ,
3477+ "rating" : 4.8
3478+ } ) ;
3479+ await addDoc ( collection ( db , "Books" ) , {
3480+ "author_id" : "author_202" ,
3481+ "title" : "Oliver Twist" ,
3482+ "rating" : 4.5
3483+ } ) ;
3484+ // [END to_scalar_expression_stage_data]
3485+ }
3486+
34413487 // https://firebase.google.com/docs/firestore/pipelines/perform-joins-with-sub-pipelines
34423488 async function toScalarExpressionStage ( ) {
34433489 // [START to_scalar_expression]
@@ -3458,6 +3504,15 @@ describe("firestore-pipelines", () => {
34583504 console . log ( result ) ;
34593505 }
34603506
3507+ async function searchBasicQueryData ( ) {
3508+ // [START search_basic_query_data]
3509+ await addDoc ( collection ( db , "Restaurants" ) , {
3510+ "name" : "Waffle Place" ,
3511+ "description" : "A cozy place for fresh waffles."
3512+ } ) ;
3513+ // [END search_basic_query_data]
3514+ }
3515+
34613516 async function pipelineSearchBasic ( ) {
34623517 // [START pipeline_search_basic]
34633518 const result = await execute ( db . pipeline ( ) . collection ( 'restaurants' )
@@ -3468,6 +3523,15 @@ describe("firestore-pipelines", () => {
34683523 console . log ( result ) ;
34693524 }
34703525
3526+ async function searchExactMatchData ( ) {
3527+ // [START search_exact_match_data]
3528+ await addDoc ( collection ( db , "Restaurants" ) , {
3529+ "name" : "Waffle Place" ,
3530+ "description" : "A cozy place for fresh waffles."
3531+ } ) ;
3532+ // [END search_exact_match_data]
3533+ }
3534+
34713535 async function pipelineSearchExact ( ) {
34723536 // [START pipeline_search_exact]
34733537 const result = await execute ( db . pipeline ( ) . collection ( 'restaurants' )
@@ -3478,6 +3542,15 @@ describe("firestore-pipelines", () => {
34783542 console . log ( result ) ;
34793543 }
34803544
3545+ async function searchTwoTermsData ( ) {
3546+ // [START search_two_terms_data]
3547+ await addDoc ( collection ( db , "Restaurants" ) , {
3548+ "name" : "Morning Diner" ,
3549+ "description" : "Start your day with waffles and eggs."
3550+ } ) ;
3551+ // [END search_two_terms_data]
3552+ }
3553+
34813554 async function pipelineSearchMultiple ( ) {
34823555 // [START pipeline_search_multiple]
34833556 const result = await execute ( db . pipeline ( ) . collection ( 'restaurants' )
@@ -3488,6 +3561,15 @@ describe("firestore-pipelines", () => {
34883561 console . log ( result ) ;
34893562 }
34903563
3564+ async function searchExcludeTermData ( ) {
3565+ // [START search_exclude_term_data]
3566+ await addDoc ( collection ( db , "Restaurants" ) , {
3567+ "name" : "City Coffee" ,
3568+ "description" : "Premium coffee and pastries."
3569+ } ) ;
3570+ // [END search_exclude_term_data]
3571+ }
3572+
34913573 async function pipelineSearchExclude ( ) {
34923574 // [START pipeline_search_exclude]
34933575 const result = await execute ( db . pipeline ( ) . collection ( 'restaurants' )
@@ -3498,6 +3580,15 @@ describe("firestore-pipelines", () => {
34983580 console . log ( result ) ;
34993581 }
35003582
3583+ async function searchScoreData ( ) {
3584+ // [START search_score_data]
3585+ await addDoc ( collection ( db , "Restaurants" ) , {
3586+ "name" : "The Waffle Hub" ,
3587+ "description" : "Everything waffles!"
3588+ } ) ;
3589+ // [END search_score_data]
3590+ }
3591+
35013592 async function pipelineSearchScore ( ) {
35023593 // [START pipeline_search_score]
35033594 const result = await execute ( db . pipeline ( ) . collection ( 'restaurants' )
0 commit comments