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.

MongodbSerializer need update for IN/NOT_IN operation for @DBRef

See original GitHub issue

I am using spring boot 1.5.2.RELEASE and querydsl-mongodb 4.1.4. Found this:

@Document
public class User {
    @DBRef
    private Addr addr;
}

and query like this:

List<Addr> addrList = ...;
return userRepo.findAll(Expressions.allOf(
        QUser.user.addr.notIn(addrList)  // ONLY worked when addrList.size() == 1
))

this may refered to MongodbSerializer#visit(Operation<?> expr, Void context) which not invoke convert properbly?

So, could this be fixed ? or give some other alternative way?

PS: current I using this :

// groovy code
    List<BooleanExpression> neAddrs = addrList.findResults { QUser.user.addr.ne(it) }.toList()
    return userRepo.findAll(allOf(
            allOf((BooleanExpression[]) neAddrs.toArray())
    ))

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
christophstroblcommented, Sep 20, 2018

I know none right of the top of my head - we tried a while ago (see: issue branch for DATAMONGO-1810) but it turned out to be insufficient and work only under certain circumstances. If you happen to find a solution a PR would be warmly welcome.

0reactions
stale[bot]commented, Jun 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MongoDB Java - List<DBRef> update is causing existing ...
I have a 3 node mongo 4.0.27 replica set with 1 primary and 2 secondary nodes. I am executing a Push operation on...
Read more >
How to query mongodb with DBRef - Stack Overflow
In using large collections you will want to index the field and query it using the below method. If you want to use...
Read more >
Create DBRefs in MongoDB - Navicat
Using the New DBRefs. Now that we've updated our an employee document to use DBRefs, we will have to alter how we go...
Read more >
Update fails when query contains part of a DBRef and results ...
When the update query contains a partial DBRef ($id / $ref / $db) with ... The upsert fails but no other operations are...
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