具有特殊字符的Firestore查询属性

时间:2018-03-21 00:12:39

标签: firebase google-cloud-firestore

我的联系人的联系人结构如下:

name: 'XPTO' emails: { susan@xpto.com: 'Susan', fred@xpto.com: 'Fred' }

但查询不会返回结果: db.firestore().collection('contacts').where('emails.susan@xpto.com', '==', 'Susan').get().then(...

因为点“susan@xpto.com”

如何逃脱点?

我已尝试``[ ]但无效。

1 个答案:

答案 0 :(得分:6)

建议您使用反引号转义字段的文档实际上是不正确的。它正处于修复过程中。相反,您应该使用FieldPath来构建要查询的字段的路径:

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    /*
     Check to see which is the delegated textField.
     Basically to do textField-specific logic.
     Helps mostly if you have multiple textFields
     */
    if textField == amountEnteredTextField {
        amountEntered()
    }

    //resign textField
    textField.resignFirstResponder()
    return true
}

func amountEntered() {
    if allowNewAmount, amountEnteredTextField.text != "" {
        amountLabel.text = amountEnteredTextField.text
        amountEnteredTextField.text = ""            
    }
}