0

i am fetching total number of count(near about 1500 record) from azure cosmosdb and its giving me following error

Error Detail

here is my code

Code Detail

getCountFilter = getCountBuilder.Eq("business_id", usermodel[0].business_id) & getCountBuilder.In("user_id", userlist) & getCountBuilder.Eq("status", 1);
                    getAllCountForApproved = getleavebyidconnection.GetFilteredCount(getCountFilter);
     public virtual long GetFilteredCount(FilterDefinition<T> filter = null)
            {
                if (filter == null)
                {
                    return collection.Count((FilterDefinition<T>.Empty));
                }
                else
                {

                    return collection.Count(filter);
                }
            }

i want a count only , if count is less its work fine but if count is more then thousand(1000) its give me error

can some one help me

Stennie
  • 63,885
  • 14
  • 149
  • 175

1 Answers1

2

Based on https://learn.microsoft.com/azure/cosmos-db/mongodb-troubleshoot:

The error code means:

The total number of request units consumed is more than the provisioned request-unit rate for the collection and has been throttled.

Consider scaling the throughput assigned to a container or a set of containers from the Azure portal or you can retry the operation.

The RetryAfterMs is the milliseconds you have to wait in order to retry the operation based on your provisioned RU/s.

Community
  • 1
  • 1
Matias Quaranta
  • 13,907
  • 1
  • 22
  • 47