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

Parser improvements #2978

Open
ironage opened this issue Jan 12, 2018 · 9 comments
Open

Parser improvements #2978

ironage opened this issue Jan 12, 2018 · 9 comments

Comments

@ironage
Copy link
Contributor

ironage commented Jan 12, 2018

Requested improvements to the query parser are listed below. These features are not required for the query serialisation task but are useful in flushing out the JS query syntax.

Description Syntax Example
SizeOperator listproperty[SIZE]
Positional listproperty[index]
Positional (First) listproperty[FIRST]
Positional (Last) listproperty[LAST]
One or more match in collection (membership) x IN listproperty
Between x BETWEEN {a, b}
One or more match in collection ANY listproperty = a
One or more match in collection SOME listproperty = a
No match in collection NONE listproperty = a
All entries in collection match ALL listproperty = a
@ironage
Copy link
Contributor Author

ironage commented Mar 6, 2018

IN, ANY, SOME, NONE, ALL were added in #2989

We should also add support for SELF to help lookup by primary key:

if (movie.sessions.filtered("SELF == $0", newSession).length == 0) {
    movie.sessions.push(newSession);
}

@RealmBot
Copy link
Collaborator

➤ Jørgen Edelbo commented:

[~james.stone] could you give an update on what is actually missing here?

@RealmBot
Copy link
Collaborator

➤ James Stone commented:

Updated list of desired features:

DescriptionSyntax ExampleSizeOperatorlistproperty[SIZE]Positionallistproperty[index]Positional (First)listproperty[FIRST]Positional (Last)listproperty[LAST]Betweenx BETWEEN {a, b}primary key lookup on SELFfiltered("SELF == $0", newSession)Long term, we want full support for everything described in the query cheat sheet: https://academy.realm.io/posts/nspredicate-cheatsheet/ ( https://academy.realm.io/posts/nspredicate-cheatsheet/ )

@Deadarius
Copy link

Any update on this, specifically IN support?

@ironage
Copy link
Contributor Author

ironage commented Sep 23, 2020

We also have requests for:

  • MATCHES regex operator.
  • SELF for primary key lookup and for primitive lists like: var res = myobject.list.filtered(‘SELF = “a” or SELF =“b”’)
  • IN where the right operand is a user input list of variables (IN is only currently supported where the right side is a list property in the schema)

@RealmBot
Copy link
Collaborator

➤ Ian Ward commented:

[~brian.munkholm] Can we add these to the quarterly backlog please? [~alexander.stigsen] and I ran into these in our IoT research recently

@abhishekmatta999
Copy link

Is there any way in Realm to make aggregation(join) b/w two collections

@ironage
Copy link
Contributor Author

ironage commented Mar 15, 2021

Hi @abhishekmatta999, in Realm you can construct relationships in your schema using links. This should replace the need to use a concept like join from SQL. If you have a specific case where you need help writing a query, please open a separate issue with more detailed information about what you are trying to do and we'd be happy to help. You can also check the docs for some query examples.

@abhishekmatta999
Copy link

Hi @abhishekmatta999, in Realm you can construct relationships in your schema using links. This should replace the need to use a concept like join from SQL. If you have a specific case where you need help writing a query, please open a separate issue with more detailed information about what you are trying to do and we'd be happy to help. You can also check the docs for some query examples.

Here's the question(issue)

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

5 participants