Azure CosmosDB query - MongoDB API


I have an Azure CosmosDB (version 4.2) resource where I run the following query against and gives me the correct response:
db.assessmentDataCollection.count({$expr: { $gt: [ “$modificationDateTime” , “$lastExportDateTime” ] }})

When I use the Java Mongo Client than I get no result. Any idea what I’m doing wrong?

final List<DocumentData> data = new ArrayList<>();
try (final MongoClient mongoClient = MongoClients.create(cosmosDBConnectionString)) {

        .getCollection("assessmentDataCollection", DocumentData.class)
        .find(Filters.expr(Document.parse("{ $gt: [ '$modificationDateTime', '$lastExportDateTime' ] }")))

you are not using the same database name

I’m so embarrassed to overlook this ‘small’ difference…

I have been there and done that, so this is one of the first thing I look.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.