在Azure DocumentDB中,如何获取集合中所有属性的列表? [英] In Azure DocumentDB, how can I get a list of all properties in a collection?

查看:55
本文介绍了在Azure DocumentDB中,如何获取集合中所有属性的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够提供集合中所有文档中所有属性的列表.

I would like to be able to provide a list of all the properties across all documents in a collection.

我想出的最好方法是查询所有文档,然后在客户端中构建列表,但这感觉不对.

The best way I can come up with is to query for all documents and then build the list in the client, but this feels wrong.

推荐答案

执行所需操作的唯一方法是阅读所有文档.但是,如果您担心带宽,则可以在仅返回属性列表的存储过程中进行操作.

The only way to do what you want is to read all of the documents. However, if you are worried about bandwidth, then you can do it in a stored procedure that only returns the list of properties.

如果您采用这种方式,建议您从countDocuments sproc

If you take that route, I recommend that you start with the countDocuments sproc here and be prepared to call as many times as necessary until the continuation comes back empty and there are no 429 errors... or use documentdb-utils which takes care of that for you.

或者,我可以在这里给你一个完整的例子.请让我知道.

Alternatively, I could give you a full on example here. Just let me know.

另一种方法是在编写文档时维护属性列表.如果您经常需要此列表,则将是首选.

Another approach would be to maintain a list of properties as documents are being written. This would be preferred if you need this list often.

这篇关于在Azure DocumentDB中,如何获取集合中所有属性的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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