1

The cosmos DB table entry manages a default Timestamp property for each table operation. While I am trying to query last updated entries based on the same time stamp field the result is not behaving as expected. The TableQuery looks like below:

TableQuery.GenerateFilterConditionForDate("Timestamp",
                QueryComparisons.GreaterThanOrEqual,
                timestamp)

Where timestamp is a DateTimeOffset object. I am getting 0 rows retrieved even with rows existing in the table with the Timestamp column holding a higher value. What is missing here?

Sayantan Ghosh
  • 998
  • 2
  • 9
  • 29

1 Answers1

1

Data in my table.

enter image description here

Query params.

enter image description here

Result.

enter image description here

var query = TableQuery.GenerateFilterConditionForDate("Timestamp", QueryComparisons.GreaterThanOrEqual, DateTimeOffset.Now.AddDays(-10).Date);
var exQuery = new TableQuery<CustomerEntity>().Where(query);
var results0 = sourcetable.ExecuteQuery(exQuery).ToList();
//var results1 = sourcetable.ExecuteQuery(exQuery).Select(ent => (CustomerEntity)ent).ToList();
Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • For more details, you can view [related posts](https://stackoverflow.com/questions/17325445/timestamp-query-in-azure). – Jason Pan Jul 14 '20 at 03:35