Querying the Cosmos DB Change Feed using SQL queries

Author: Matthieu Maitre

I need to access Cosmos DB data through a middleware API that gives access to SQL queries but not the change feed (i.e. DocumentClient.CreateDocumentQuery() but not DocumentClient.CreateDocumentChangeFeedQuery()). Is it possible to query the change feed using regular SQL queries?

I was thinking about filtering documents on recent _ts but I am not sure timestamps are guaranteed to be monotonically increasing across entire collections due to potential clock drift across the VMs Cosmos DB runs on.

Originally Sourced from: https://stackoverflow.com/questions/57450878/querying-the-cosmos-db-change-feed-using-sql-queries