-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add null value filter #1721
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
Draft
sadakchap
wants to merge
7
commits into
parse-community:alpha
Choose a base branch
from
sadakchap:add-isnull-filter
base: alpha
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b53fd00
add isNull filter for all datatypes
sadakchap 38d2f16
filtering null values only
sadakchap 761cdc4
changed filter name & query
sadakchap dec4980
Merge branch 'master' into add-isnull-filter
mtrezza 2b3211d
Merge branch 'master' into add-isnull-filter
mtrezza 936275f
Merge branch 'alpha' into add-isnull-filter
mtrezza c2f36ec
Merge branch 'alpha' into add-isnull-filter
mtrezza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this query will return null values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, it will also include records which does not have filter field even set, that's why the name of filter
does not exits or null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good
You can set composable to true if you to do multiple filters on a field. Similar to how less than does it. (Perhaps we should document these)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling composable is a good idea.
Regarding the commented code here, the difference is the MongoDB performance. The current query is an explicit "does not exist or is null" conditional, without
$and
. This distinction is also relevant for indexing.Enabling composable and add this filter query allows for both ways, so that's the most versatile way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean document
composable
andcomparable
it usually takes a while to figure out what they mean.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sends
where={age:{$exists: true}}
if you set a combined filter of (1) and (2)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
I think that's strange as, for let's say 2 filters
less than
&exists
, we do something likeThis sends a query like
where={age: {$lt: 4, $exists: true}}
Then, why not this
sends a query like
where={age: {$eq: null, $exists: true}}
.I tried searching in thee docs about
equalTo
query, whether it is composble or not. But, there's nothing about that 😕There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dplewis when you mentioned
composable
, on what level did you mean that? On a MongoDB level?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's a limitation with MongoDB rather it's with JS Sdk.(just an opinion)
As when I explicitly(using cURL) make a request with
where={age: {$exists: true, $eq: null }}
, it does return records only withnull
field value.But, when I'm trying to couple
$exists
&$eq
query, it only sends request withwhere={age: {$exists: true}}
.I'm trying this way to construct the query
Maybe I'm missing some point with js sdk. Would really appreciate any help with creating a query with
where={age: {$exists: true, $eq: null }}
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a new issue for this parse-community/Parse-SDK-JS#1372.