-
May 1st, 2011, 06:19 AM
#1
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
-
May 1st, 2011, 11:54 AM
#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
-
May 1st, 2011, 02:10 PM
#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
-
May 2nd, 2011, 02:24 AM
#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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules