Sunday 15 March 2015

spring data mongodb - QueryDSL isNotEmpty expression failing -


I am trying to execute an expression that returns a set of results where the archive attribute is not empty here my classes

A class

  @document public class A {@Id string ID; String name; List & lt; P & gt; Matches; }  

b class

  @documentary public class B {String name; }  

My test case

  @Test Public Zero TestingFinanceCollectionNotApplety () {BB1 = new B (); B1 Name = "b1"; BB2 = new B (); B2 Name = "b2"; Template.save (b1); Template.save (b2); A1 = new A (); A1.id = "p1"; A1.matches = arrays.asList (B1, B2); A2 = new A (); A2.id = "a2"; A2.matches = New Arrestist & lt; B & gt; (); A3 = new A (); A3.id = "a3"; A3.matches = null; Template.save (A1); Template.save (A2); Template.save (A3); QA QA = QA.A. Boolean expression expr = qa.matches.isNotEmpty (); Iterable & lt; A & gt; Results = aRepo.findAll (expr); AssertThat (The result is, (not ((empty () ()))))); A BADVALUE $ or need:}  

When I tested this I can not perform get the following error:

  com.mongodb.MongoException: canonicalize Query Com.mongodb.queryResultIterator.throwOnQueryFailure on array com.mongodb.queryResultIterator.init (QueryResultIterator.java198) com.mongodb.QueryResultIterator.initFromQueryResponse (QueryResultIterator.java:176) com.mongodb (query ResultIterator.java.0014). QueryResultIterator & Lt; Init & gt; ._check com.mongodb.DBCursor on com.mongodb.DBCollectionImpl.find (DBCollectionImpl.java:86) (QueryResultIterator.java:64) com.mongodb.DBCollectionImpl.find (DBCollectionImpl.java:66) on com.mongodb.DBCursor At com.mongodb.DBCursor.hasNext (DBCursor.java ts7171) at com.mysema.query.mongodb.mongodbQuery at ._hasNext (DBCursor.java/46). On Org.springframework.data.mongodb.repository.support.QueryDslMongoRepository.findAll (MongodbQuery.java:253) list (QueryDslMongoRepository.java:102)  

You here on

Can I try it for

Am I doing something wrong?

This issue has now went the fixed version of QueryDSL 3.6.3. See for more information.

included Many thanks to all those who decide!


No comments:

Post a Comment