且构网

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

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

更新时间:2023-02-15 09:59:24

做你想做的唯一方法就是阅读所有的文档.但是,如果您担心带宽,那么您可以在只返回属性列表的存储过程中进行.

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 此处 并准备根据需要多次调用,直到继续返回为空且没有 429 错误...或使用 documentdb-utils 为您处理此问题.

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.