I am using Cosmos DB, and I try to query data based on the PartitionKey and a Datetime field. Using the Cosmos DB Data Explorer in the Azure Portal the query editor produces the following query:
PartitionKey eq 'myPartitionKey' and Timestamp ge datetime'2022-08-13T20:40:11.426Z'
This returns data as expected. However, if I try the same query using the C# Table API it seems something is off (or maybe I did an issue here):
string queryDate = DateTime.UtcNow.AddDays(-31).ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture);
string query = $"PartitionKey eq '{slug}' and Timestamp ge datetime'{queryDate}'";
AsyncPageable<TableEntity> queryResultsMaxPerPage = tableClient.QueryAsync<TableEntity>(filter: query, maxPerPage: 500);
await foreach (Page<TableEntity> page in queryResultsMaxPerPage.AsPages())
{
...
}
This doesn't return any Data unfortunately. If I try this code with another query, it returns data as expected. For example if I use the following query, I am able to query data and get a response containing:
PartitionKey eq 'myPartitionKey'
Hope someone can help me