jirutka/rsql-parser

=q= operator and handling nested attributes

Closed this issue · 2 comments

When reading the source code I noticed that the QueryOperator enum has a SUB_CONDITION_ANY value attached to "=q=". But I don't see "=q=" mentioned anywhere in the documentation. How does it work and what can we use it for?

Right now I'm trying to transform a RSQL string into a MongoDB query. I need to query for nested attributes, e.g. "documents.status". When doing so I get a node with key "documents.status" but I would expect to get a node with key "documents" containing a node with key "status" so that I in my MongoVisitor could add an elemMatch in between. Are "=q=" somehow related to this and if not how can it be that the default parsing for my query does not yield the expected result ?

Here is a concrete example:
documents.status!=CREATED

I get the following mongo expression:
{ "documents.status" : { "$ne" : "CREATED" } }

But would expect the following:
{ "documents": { "$elemMatch": { "status": { "$ne" : "CREATED" } } } }

Thank you for your support.

Kind regards
Morten

There’s no SUB_CONDITION_ANY anywhere in the source code of rsql-parser and =q= is not a “standard” RSQL operator, it’s a custom operator.

That is a very good answer 😃 I confused your lib. with another one using you lib. Sorry for taking your time.