question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filters not working after upgrading to 4.4.0

See original GitHub issue

After trying to upgrade from 4.2.8 (tested on 4.3.0, seems to work OK there) to 4.4.0 I am getting errors in my tests because the filters doesn’t seem to work as they used to. Only change is the upgrade to my kmongo-coroutine version.

Is there something in these filters that is expected to break between 4.3.0 and 4.4.0?

val filter = and(
    or(
        MyClass::someId eq someId,
        MyClass::someOtherId eq someOtherId,
        MyClass::nestedObject / NestedClass::yetAnotherId eq yetAnotherId
    ),
        MyClass::nestedObject exists true
)
collection
    .find(clientSession, filter)
    .sort(descending(MyClass::lastModifiedDate))
    .toList()

For instance I am now getting back documents that clearly does not have the “MyClass::nestedObject”.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
zigzagocommented, Feb 12, 2022

@Lezzio I do reproduce the bug with ObjectMappingConfiguration.serializeNull = false & save/replace usage. I’m going to release a fix (see https://github.com/Litote/kmongo/issues/319)

0reactions
zigzagocommented, Feb 12, 2022

@bjaanes this should work with 4.4.0 and above:

fun setUpMongoClient(dbUri: String, vararg jacksonModules: Module): CoroutineClient {
    //must be called before any KMongoConfiguration call
    ObjectMappingConfiguration.serializeNull = false
    val connectionString = ConnectionString(dbUri)
    val settings: MongoClientSettings = MongoClientSettings.builder()
        .applyConnectionString(connectionString)
        .retryWrites(true)
        .build()
   //do not use bsonMapper directly 
    jacksonModules.forEach { KMongoConfiguration.registerModule(it) }
    //this is handled by ObjectMappingConfiguration.serializeNull 
    //KMongoConfiguration.bsonMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
    return KMongo.createClient(settings).coroutine
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

The translation:update command fails in 4.4.0 due to missing ...
Running the translation extraction/update command that worked in Symfony 4.3.x produces the following error after upgrading to 4.4.0, ...
Read more >
Filters in Filter bar not works - SAP Community
I'm asking for help with filters in "Filter bar" in "Bi launch pad (InfoView)". Filters worked fine on version SAPBO 4.0 Patch 2.16...
Read more >
Product Attribute Filtering Widget Not Working - WordPress.org
Hi,. The Product Attribute Filtering Widget doesn't work on my sidebar. After some research, I found that create a new product and add...
Read more >
Mule Runtime Engine 4.4.0 Release Notes
October 2022. Patch release version: 4.4.0-20220922. This patch update addresses the following Mule issues: ...
Read more >
Upgrading from 4.3.X to 4.4.0 | Upgrading | Curity
Upgrading from 4.3.X to 4.4.0 – Version 4.4.0 contains a few small changes to templates, but no configuration or database schema changes. No...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found