Android whereEqualTo支持HashMap相等吗?

Android whereEqualTo支持HashMap相等吗?,android,kotlin,google-cloud-firestore,hashmap,equality,Android,Kotlin,Google Cloud Firestore,Hashmap,Equality,API可以将任何作为其参数。这是否意味着我可以向它传递一个HashMap,它将比较其匹配字段与Firestore数据库中map类型字段的匹配字段,还是我必须手动比较映射的每个属性 我构建了一个类似这样的查询 collection.whereEqualTo("meta", hashMapOf( // <-- using full hash-map for matching "user" to "JD", "

API可以将
任何
作为其参数。这是否意味着我可以向它传递一个
HashMap
,它将比较其匹配字段与
Firestore
数据库中
map
类型字段的匹配字段,还是我必须手动比较映射的每个属性

我构建了一个类似这样的查询

collection.whereEqualTo("meta", hashMapOf( // <-- using full hash-map for matching
    "user" to "JD",
    "name" to "John"
))
我使用的条件应该会产生一些结果,但它不会(不会崩溃),所以我想知道我是否在其他地方犯了错误,或者这种类型的查询根本不受支持?结果是空的

我也可能只搜索
name
属性,并使用类似这样的简单查询来查找所有Johns


Firestore可以将客户端代码中的映射项与文档中的映射项进行比较。但是映射必须完全等效,因此必须在代码中指定所有属性。因此,类似这样的方法应该有效:

collection.whereEqualTo("meta", hashMapOf( // <-- using parcial hash-map for matching
    "user" to "JD",
    "name" to "John"
))

collection.whereEqualTo(“meta”),hashMapOf(//请编辑问题,以显示您认为此查询应匹配的文档。还要明确
user
name
是什么。硬编码值效果最好。事实上,我创建了更多测试,部分映射不起作用。您需要单独比较每个字段,并且需要创建多个索引以支持查询所有可能的组合。
collection.whereEqualTo("meta", hashMapOf( // <-- using parcial hash-map for matching

    "name" to "John"
))
collection
    .whereEqualTo("meta.user", "JD")
    .whereEqualto("meta.name", "John")
collection.whereEqualTo("meta", hashMapOf( // <-- using parcial hash-map for matching
    "user" to "JD",
    "name" to "John"
))