Get record count in Azure DocumentDb

后端 未结 8 1833
孤街浪徒
孤街浪徒 2021-02-03 18:44

It seems like \'select count(*) from c\' in the SQL queries allowed by documentdb in the azure site and through the documentdb explorer (https://studiodocumentdb.codeplex.com/)

8条回答
  •  故里飘歌
    2021-02-03 19:04

    My code count solution is also working...once I just selected the id as a Papa Ours pointed out :) To get my original post to work, replace this line:

    var documentCount = dc.CreateDocumentQuery(update.SelfLink, "SELECT * FROM c").ToList();
    

    with this line:

    var documentCount = dc.CreateDocumentQuery(update.SelfLink, "SELECT id FROM c").ToList()
    

    I still like the idea of the stored procedure as it will work in the documentdb studio (really cool project :)) - https://studiodocumentdb.codeplex.com/

提交回复
热议问题