Announcement Announcement Module
Collapse
No announcement yet.
Repository Query Method - NotNull keyword not returning anything Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Repository Query Method - NotNull keyword not returning anything

    Hi

    I'm trying to create a repository query method that uses the keyword NotNull, for example

    List<Wine> findByWineNameNotNull();

    But it's not returning any data, but I know there's matching data and a simple mongodb query to run the following

    db.wine.find({"wineName": {"$ne": null}}, {wineName: 1});

    works fine and returns the expected results.

    Has anybody used the NotNull (or the IsNotNull) keyword and got it to work?

    Have I missed something?

    Thanks in advance

    Derek

  • #2
    Hi Derek,

    have you tried setting the log level to debug? MongoQueryCreator should log the actual Mongo query created from the method.

    Cheers,
    Ollie

    Comment


    • #3
      Hi Ollie

      Thanks so much for the quick reply, especially on a sunday.

      The output from the MongoQueryCreator was

      "Created query { "wineName" : { }}"

      And then there was this from the MongoTemplate

      "find using query: { "wineName" : { }} fields: null for class: class com.xyz.Wine" }

      Where I would've expected to see the {"$ne" : null}

      Bug?

      Derek

      Comment


      • #4
        Yes, I think so. It seems MongoQueryCreator doesn't cover the NotNull case at all. Feel fre to raise bug in JIRA.

        Thanks for spotting this!
        Ollie

        Comment

        Working...
        X