CosmosDB is returning more than the default number of records

Viewed 83

I'm using go1.18 and go-cosmosdb to fetch records from CosmosDB:

opts := cosmosapi.QueryDocumentsOptions{
    IsQuery:              true,
    ContentType:          cosmosapi.QUERY_CONTENT_TYPE,
    ConsistencyLevel:     cosmosapi.ConsistencyLevelStrong,
    EnableCrossPartition: false,
}

resp, err := c.client.QueryDocuments(ctx, DatabaseName, ContainerName, query, &res, opts)

The query is a simple select * query.

Since I'm not setting opts.MaxItemCount, it should default to 0, and the returned documents should be up to a 100 according to the azure docs:

Query requests support pagination through the x-ms-max-item-count and x-ms-continuation request headers. The x-ms-max-item-count header specifies the maximum number of values that can be returned by the query execution. This can be between 1 and 1000, and is configured with a default of 100.

But it weirdly returns more than a 100. I'm not sure if this is a new change? I'm pretty sure I used this before and it used to return only a hundred records. Any thoughts?

0 Answers
Related