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

查看:52
本文介绍了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天全站免登陆