Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String filters and Null values #2359

Closed
kzangeli opened this issue Jul 14, 2016 · 5 comments
Closed

String filters and Null values #2359

kzangeli opened this issue Jul 14, 2016 · 5 comments
Assignees
Milestone

Comments

@kzangeli
Copy link
Member

The string filters don't consider attribute/metadata values of type Null.
For some reason this case wasn't taken into consideration when implementing the string filters.

Effort: 1 man day

@fgalan
Copy link
Member

fgalan commented Jul 14, 2016

To be precise, this issue refers to the JSON datatype null.

@fgalan
Copy link
Member

fgalan commented Jul 15, 2016

Both for q and mq.

@kzangeli
Copy link
Member Author

We might have just forgotten about NULL when implementing string filters.
However, I did a quick test and it failed:

StringFilter::mongoFilterPopulate()
{
  ...
  case SfvtNull:
    bb.append("$exists", true).append("$in", BSON_ARRAY("null"));
    break;

That try gives the string "null" in the query:

attrs.A1.value.N: { $exists: true, $in: [ "null" ] } }

And trying with NULL:

  case SfvtNull:
    bb.append("$exists", true).append("$in", BSON_ARRAY(NULL));
    break;

Well, that doesn't even compile.
Not very important, leaving it for later.
To fix this, look at servicePath and copy how it's done there:

servicePath: { $in: [ /^/.*/, null ] }

@fgalan
Copy link
Member

fgalan commented Jul 22, 2016

Not sure, but I remember something like this in a similar case... it may work.

    BSONObj empty;
    bb.append("$exists", true).append("$in", BSON_ARRAY(empty));

@fgalan
Copy link
Member

fgalan commented Jan 11, 2017

Fixed by PR #2806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants