How to use ISODate in MongoAPI

Usually we would use the following syntax to filter a collection by a date in Mongo

{
   "CreationDate": { $gt: ISODate('2022-01-01T00:00:00Z')}
}

That doesnt work in the API (especially when using the Dataverse Connector in PowerPlatform). There we can use the following syntax

{
   "CreationDate": { "$gt": {"$date" : "2022-01-01T00:00:00Z" } }
}

See that this needs to be valid JSON not EJSON. Hope that helps, took me a while to figure that out.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.