Skip to content

Commit d5bdfca

Browse files
committed
add type and generic snippets
1 parent 6f0bba9 commit d5bdfca

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

firestore-next/test.firestore.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,7 @@ describe("firestore-pipelines", () => {
13501350
or,
13511351
xor,
13521352
conditional,
1353+
concat,
13531354
like,
13541355
execute
13551356
} = require("firebase/firestore/pipelines");
@@ -1368,6 +1369,24 @@ describe("firestore-pipelines", () => {
13681369
db = getFirestore(app, "enterprise");
13691370
});
13701371

1372+
async function typeAndGenericFunctionsExample() {
1373+
// [START type_function]
1374+
field("rating").type();
1375+
// [END type_function]
1376+
1377+
// [START concat_function]
1378+
concat(constant("Author ID: "), field("authorId"));
1379+
// [END concat_function]
1380+
1381+
// [START length_function]
1382+
field("tags").length();
1383+
// [END length_function]
1384+
1385+
// [START reverse_function]
1386+
field("tags").reverse();
1387+
// [END reverse_function]
1388+
}
1389+
13711390
async function stagesExpressionsExample() {
13721391
// [START stages_expressions_example]
13731392
const trailing30Days = constant(Timestamp.now().toMillis())

firestore-temp/test.firestore.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ describe("firestore-pipelines", () => {
2323
like,
2424
or,
2525
xor,
26-
conditional
26+
conditional,
27+
concat
2728
} = require("@google-cloud/firestore/pipelines");
2829

2930
let app;
@@ -36,6 +37,24 @@ describe("firestore-pipelines", () => {
3637
});
3738
});
3839

40+
async function typeAndGenericFunctionsExample() {
41+
// [START type_function]
42+
field("rating").type();
43+
// [END type_function]
44+
45+
// [START concat_function]
46+
concat(constant("Author ID: "), field("authorId"));
47+
// [END concat_function]
48+
49+
// [START length_function]
50+
field("tags").length();
51+
// [END length_function]
52+
53+
// [START reverse_function]
54+
field("tags").reverse();
55+
// [END reverse_function]
56+
}
57+
3958
async function queryExplainExample() {
4059
// [START query_explain]
4160
const q = db.collection("cities").where("country", "==", "USA");

0 commit comments

Comments
 (0)