Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
362 changes: 252 additions & 110 deletions firestore/extend-with-functions/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion firestore/extend-with-functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compile": "cp ../../tsconfig.json.template ./tsconfig.json && tsc"
},
"dependencies": {
"@google-cloud/firestore": "^4.1.1",
"@google-cloud/firestore": "^4.4.0",
"firebase-admin": "^9.2.0",
"firebase-functions": "^3.11.0"
}
Expand Down
11 changes: 10 additions & 1 deletion firestore/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,11 @@ async function queryAndFilter(db) {
const nameQueryRes = await citiesRef.where('name', '>=', 'San Francisco').get();
// [END example_filters]

for (const q of [stateQueryRes, populationQueryRes, nameQueryRes]) {
// [START simple_query_not_equal]
const capitalNotFalseRes = await citiesRef.where('capital', '!=', false).get();
// [END simple_query_not_equal]

for (const q of [stateQueryRes, populationQueryRes, nameQueryRes, capitalNotFalseRes]) {
q.forEach(d => {
console.log('Get: ', d);
});
Expand Down Expand Up @@ -610,12 +614,17 @@ async function inQueries(db) {
const usaOrJapan = await citiesRef.where('country', 'in', ['USA', 'Japan']).get();
// [END in_filter]

// [START not_in_filter]
const notUsaOrJapan = await citiesRef.where('country', 'not-in', ['USA', 'Japan']).get();
// [END not_in_filter]

// [START in_filter_with_array]
const exactlyOneCoast = await citiesRef.where('region', 'in',
[['west_coast', 'east_coast']]).get();
// [END in_filter_with_array]

console.log('USA or Japan get: ', usaOrJapan);
console.log('Not USA or Japan get: ', notUsaOrJapan);
console.log('Exactly One Coast get: ', exactlyOneCoast);
}

Expand Down
975 changes: 400 additions & 575 deletions firestore/main/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions firestore/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"main": "index.js",
"scripts": {
"test-debug": "env DEBUG=firestore-snippets-node mocha index.js",
"test": "env ./node_modules/.bin/mocha --timeout 20000 index.js",
"test": "firebase --project=$GCLOUD_PROJECT emulators:exec './node_modules/.bin/mocha --timeout 20000 index.js'",
"compile": "cp ../../tsconfig.json.template ./tsconfig.json && tsc"
},
"author": "",
"license": "ISC",
"dependencies": {
"@google-cloud/firestore": "^2.6.0",
"@google-cloud/firestore": "^4.4.0",
"firebase-admin": "^9.2.0",
"firebase-functions": "^3.11.0"
},
Expand Down
8 changes: 5 additions & 3 deletions firestore/solution-scheduled-backups/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ app.get('/cloud-firestore-export', async (req, res) => {
};

const { outputUriPrefix } = req.query;
if (!outputUriPrefix) {
if (!(typeof outputUriPrefix === 'string')) {
res.status(500).send('outputUriPrefix required');
} else if (outputUriPrefix && outputUriPrefix.indexOf('gs://') !== 0) {
return;
} else if (outputUriPrefix.indexOf('gs://') !== 0) {
res.status(500).send(`Malformed outputUriPrefix: ${outputUriPrefix}`);
return;
}

// Construct a backup path folder based on the timestamp
Expand All @@ -41,7 +43,7 @@ app.get('/cloud-firestore-export', async (req, res) => {

// If specified, mark specific collections for backup
const { collections } = req.query;
if (collections) {
if (typeof collections === 'string') {
body.collectionIds = collections.split(',');
}

Expand Down
Loading