LIMIT support in queries (#2008)

* Updating to Realm Sync 3.9.9 (and Core 5.10.0 + object store).
* Adding LIMIT to tests
* Use bitnami node image
This commit is contained in:
Kenneth Geisshirt 2018-09-12 15:01:44 +02:00 committed by GitHub
parent c6753efe5a
commit f45ba1c9e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 11 deletions

View File

@ -1,8 +1,6 @@
X.Y.Z Release notes
=============================================================
### Compatibility
* Sync protocol: 24
* Server-side history format: 4
* File format: 7
* Realm Object Server: 3.0.0 or later
@ -13,6 +11,7 @@ X.Y.Z Release notes
* Exposed `User.serialize` to create a persistable representation of a user instance, as well as
`User.deserialize` to later inflate a `User` instance that can be used to connect to Realm Object
Server and open synchronized Realms (#1276).
* Added support for `LIMIT` in queries to restrict the size of the results set. This is in particular useful for query-based synced Realms. An example of the syntax is `age >= 20 LIMIT(2)`.
### Bug fixes
* Removed a false negative warning when using `User.createConfiguration`.
@ -21,8 +20,8 @@ Server and open synchronized Realms (#1276).
* Fixed the type definitions for `Session.addConnectionNotification` and `Session.removeConnectionNotification`
### Internal
* Realm Core v5.7.2.
* Realm Sync v3.9.1.
* Upgraded to Realm Core v5.10.0.
* Upgraded to Realm Sync v3.9.9.
2.15.3 Release notes (2018-8-24)
=============================================================

3
Jenkinsfile vendored
View File

@ -181,7 +181,8 @@ def doDockerBuild(target, postStep = null) {
try {
reportStatus(target, 'PENDING', 'Build has started')
docker.image('node:6').inside('-e HOME=/tmp') {
// We use the bitnami/node image since it comes with GCC 6.3
docker.image('bitnami/node:6').inside('-e HOME=/tmp') {
sh "scripts/test.sh ${target}"
if(postStep) {
postStep.call()

View File

@ -1,5 +1,5 @@
PACKAGE_NAME=realm-js
VERSION=2.15.3
REALM_CORE_VERSION=5.7.2
REALM_SYNC_VERSION=3.9.1
REALM_CORE_VERSION=5.10.0
REALM_SYNC_VERSION=3.9.9
REALM_OBJECT_SERVER_VERSION=3.0.0

View File

@ -1,4 +1,4 @@
The Realm JavaScript SDK supports querying based on a language inspired by [NSPredicate](https://realm.io/news/nspredicate-cheatsheet/).
The Realm JavaScript SDK supports querying based on a language inspired by [NSPredicate](https://realm.io/news/nspredicate-cheatsheet/).
The {@link Realm.Collection#filtered Collection.filtered()} method is used to query a Realm:
@ -24,8 +24,8 @@ let merlots = wines.filtered('variety == $0 && vintage <= $1', 'Merlot', maxYear
### Conditional operators
You can use equality comparison on all property types:
`==` and `!=`
You can use equality comparison on all property types:
`==` and `!=`
Furthermore, the following can be used on numerical types:
`<`, `<=`, `>`, `>=`
@ -75,6 +75,15 @@ realm.objects('Person').filtered('birthday == T1435846997:233') // equivalent to
realm.objects('Person').filtered('birthday == 1970-1-1@0:0:0:0') // epoch is the default non-null Timestamp value
```
### Limiting the size of the result set
In order to limit the number of objects in a result set, you can use `LIMIT`.
Example:
```JS
realm.objects('Person').filtered('age >= 20 LIMIT(2)') // at most two objects which fulfil the condition
```
### Queries on collections
When objects contain lists you can query into them using the collection operators `ANY`, `ALL` and `NONE`.

@ -1 +1 @@
Subproject commit 97fd03819f398b3c81c8b007feaca8636629050b
Subproject commit b0fc2814d9e6061ce5ba1da887aab6cfba4755ca

View File

@ -37,6 +37,9 @@
"OTHER_LDFLAGS": ["-framework Foundation"],
"WARNING_CFLAGS": [ "<@(warning-flags)" ]
}
}],
["OS=='linux'", {
"defines": [ "_GLIBCXX_USE_CXX11_ABI=0" ]
}]
],
# windows stuff

View File

@ -81,6 +81,7 @@
["QueryCount", 3, "IntObject", "intCol <= 100"],
["QueryCount", 1, "IntObject", "intCol > 0x1F"],
["QueryCount", 1, "IntObject", "intCol == $0", 100],
["QueryCount", 2, "IntObject", "intCol >= 0 LIMIT(2)"],
["QueryThrows", "IntObject", "intCol == 'not an int'"],
["QueryThrows", "IntObject", "intCol == true"],
@ -112,6 +113,7 @@
["QueryCount", 3, "FloatObject", "floatCol <= 100.2"],
["QueryCount", 1, "FloatObject", "floatCol > 0x1F"],
["QueryCount", 1, "FloatObject", "floatCol == $0", 100.2],
["QueryCount", 2, "FloatObject", "floatCol >= 0.0"],
["QueryThrows", "FloatObject", "floatCol == 'not a float'"],
["QueryThrows", "FloatObject", "floatCol == true"],
@ -146,6 +148,7 @@
["QueryCount", 3, "DoubleObject", "doubleCol <= 100.2"],
["QueryCount", 1, "DoubleObject", "doubleCol > 0x1F"],
["QueryCount", 1, "DoubleObject", "doubleCol == $0", 100.2],
["QueryCount", 2, "DoubleObject", "doubleCol >= 0.0 LIMIT(2)"],
["QueryThrows", "DoubleObject", "doubleCol == 'not a double'"],
["QueryThrows", "DoubleObject", "doubleCol == true"],
@ -192,6 +195,7 @@
["QueryCount", 9, "StringObject", "stringCol CONTAINS ''"],
["QueryCount", 2, "StringObject", "stringCol == $0", "a"],
["QueryCount", 2, "StringObject", "stringCol ENDSWITH $0", "c"],
["QueryCount", 2, "StringObject", "stringCol BEGINSWITH 'a' LIMIT(2)"],
["QueryThrows", "StringObject", "stringCol == true"],
["QueryThrows", "StringObject", "stringCol == 123"],