Hi,
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)) {
mongoClient
.getDatabase("assessmentDB")
.withCodecRegistry(
CodecRegistries.fromRegistries(
MongoClientSettings.getDefaultCodecRegistry(),
CodecRegistries.fromProviders(PojoCodecProvider.builder().automatic(true).build())
)
)
.getCollection("assessmentDataCollection", DocumentData.class)
.find(Filters.expr(Document.parse("{ $gt: [ '$modificationDateTime', '$lastExportDateTime' ] }")))
.into(data);
}