Firestore 获取值不在数组中的文档? [英] Firestore get documents where value not in array?

查看:29
本文介绍了Firestore 获取值不在数组中的文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法获取数组字段不包含一个或多个值的所有文档,现在有array-contains"但是否有类似array-not-contains"的东西?

Is there a way to get all documents which array field does not contain one or more values, now there is "array-contains" but is there something like "array-not-contains"?

推荐答案

只能基于索引查询 Firestore,这样查询都可以扩展到搜索数十亿文档而不会出现性能问题.

You can only query Firestore based on indexes, so that queries all scale up to search billions of documents without performance problems.

索引通过记录数据集中存在的值来工作.如果索引跟踪不存在的东西,它就不可能高效.这是因为与您的数据集相比,不存在的值的范围非常大,因此无法编入索引.查询某个值是否不存在将需要扫描您的所有文档,而这无法扩展.

Indexes work by recording values that exist in your data set. An index can't possibly be efficient if it tracks things that don't exist. This is because the universe of non-existant values compared to your data set is extremely large and can't be indexed as such. Querying for non-existence of some value would require a scan of all your documents, and that doesn't scale.

这篇关于Firestore 获取值不在数组中的文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆