Skip to content

Commit

Permalink
Add backticks to escape field names.
Browse files Browse the repository at this point in the history
Add clasp badge to README.
  • Loading branch information
LaughDonor committed May 11, 2020
1 parent 0edb5f7 commit 6ba495f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Firestore for Google Apps Scripts

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

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

Expand Down
4 changes: 3 additions & 1 deletion Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ var FirestoreQuery_ = function (from, callback) {

// @see {@link https://firebase.google.com/docs/firestore/reference/rest/v1/StructuredQuery#FieldReference Field Reference}
const fieldRef = function (field) {
return { 'fieldPath': field }
var escapedField = field.split('.').map(function (f) { return '`' + f.replace('`', '\\`') + '`' }).join('.')
return { 'fieldPath': escapedField }
}

const filter = function (field, operator, value) {
operator = operator.toLowerCase().replace('_', '')

Expand Down

0 comments on commit 6ba495f

Please sign in to comment.