且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Azure DocumentDB中,如何获取集合中所有属性的列表?

更新时间:2023-02-15 10:04:15

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

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.