Skip to content

Commit 6ba495f

Browse files
committed
Add backticks to escape field names.
Add clasp badge to README.
1 parent 0edb5f7 commit 6ba495f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.github/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Firestore for Google Apps Scripts
22

33
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
4+
[![clasp](https://img.shields.io/badge/built%20with-clasp-4285f4.svg)](https://github.com/google/clasp)
45

56
### A Google Apps Script library for accessing Google Cloud Firestore.
67

Query.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ var FirestoreQuery_ = function (from, callback) {
3434

3535
// @see {@link https://firebase.google.com/docs/firestore/reference/rest/v1/StructuredQuery#FieldReference Field Reference}
3636
const fieldRef = function (field) {
37-
return { 'fieldPath': field }
37+
var escapedField = field.split('.').map(function (f) { return '`' + f.replace('`', '\\`') + '`' }).join('.')
38+
return { 'fieldPath': escapedField }
3839
}
40+
3941
const filter = function (field, operator, value) {
4042
operator = operator.toLowerCase().replace('_', '')
4143

0 commit comments

Comments
 (0)