forked from mongodb/docs-realm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rearranged page order and updated example snippet formatting
- Loading branch information
1 parent
8180c37
commit c86e869
Showing
29 changed files
with
845 additions
and
360 deletions.
There are no files selected for viewing
262 changes: 165 additions & 97 deletions
262
examples/node/v12/__tests__/realm-query-language.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...ormatted/realm-query-language.test.snippet.backlinks-aggregate-operators.ts.rst
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...d/node/v12/formatted/realm-query-language.test.snippet.backlinks-atLinks.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.. code-block:: typescript | ||
// Find items that belong to a project with a quota | ||
// less than 10 (using '@links'). | ||
// Find items that belong to a project with a quota less than 10 | ||
// (using '@links.<ObjectType>.<PropertyName>'). | ||
"@links.Project.items.quota < 10" |
27 changes: 21 additions & 6 deletions
27
...rmatted/realm-query-language.test.snippet.backlinks-collection-operators.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
.. code-block:: typescript | ||
// Find items where ANY project that references the item | ||
// has a quota greater than 10. | ||
"ANY @links.Project.items.quota > 10" | ||
// Find items where ALL projects that reference the item | ||
// have a quota less than 5. | ||
"ALL @links.Project.items.quota < 5" | ||
// Find items where no project that references the item | ||
// has a quota greater than 10. | ||
"NONE @links.Project.items.quota > 10" | ||
// Find items where all projects that reference the item | ||
// have a quota less than 5. | ||
"ALL @links.Project.items.quota < 5" | ||
// Find items that are referenced by multiple projects. | ||
"projects.@count > 1" | ||
// Find items that are not referenced by any project. | ||
"@links.Project.items.@count == 0" | ||
// Find items that belong to a project where the average item has | ||
// been worked on for at least 10 minutes | ||
"@links.Project.items.items.@avg.progressMinutes > 10" | ||
// Find items that are not referenced by another | ||
// object of any type (backlink count is 0). | ||
"@links.@count == 0" |
1 change: 1 addition & 0 deletions
1
...v12/formatted/realm-query-language.test.snippet.backlinks-linkingObjects.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.. code-block:: typescript | ||
// Find items that belong to a project with a quota greater than 10 | ||
// through the Item object's `projects` property | ||
// (using 'LinkingObjects'). | ||
"projects.quota > 10" |
9 changes: 6 additions & 3 deletions
9
...ed/node/v12/formatted/realm-query-language.test.snippet.basic-arithmetic.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
.. code-block:: typescript | ||
// Find items with a `priority` greater than 3. | ||
"2 * priority > 6" // `priority > 3` | ||
"priority >= 2 * (2 - 1) + 2" // `priority >= 4` | ||
// Evaluate against an item's `priority` property value: | ||
"2 * priority > 6" // resolves to `priority > 3` | ||
"priority >= 2 * (2 - 1) + 2" // resolves to `priority >= 4` | ||
// Evaluate against multiple object property values: | ||
"progressMinutes * priority == 90" |
This file contains 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 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
2 changes: 2 additions & 0 deletions
2
...d/node/v12/formatted/realm-query-language.test.snippet.deep-dot-notation.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.. code-block:: typescript | ||
// Find projects whose `projectLocation` property contains | ||
// an embedded Address object with a specific zip code. | ||
"projectLocation.address.zipcode == 10019" |
30 changes: 13 additions & 17 deletions
30
...ode/v12/formatted/realm-query-language.test.snippet.dictionary-operators.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
.. code-block:: typescript | ||
// Find `comments` dictionary properties with key 'status'. | ||
// Find projects whose `comments` dictionary property | ||
// have a key of 'status'. | ||
"comments.@keys == $0", "status" | ||
// Find `comments` dictionary properties with key 'status' | ||
// and value 'On track'. | ||
"comments['status'] == $0", "On track" | ||
// Find `comments` dictionary properties with | ||
// more than one key-value pair. | ||
"comments.@count > $0", 1 | ||
// Find projects whose `comments` dictionary property | ||
// have a 'status' key with a value that ends in 'track'. | ||
"comments['status'] LIKE $0", "*track" | ||
// Find `comments` dictionary properties where ANY | ||
// values are of type 'string`. | ||
"ANY comments.@type == 'string'" | ||
"comments.@type == 'string'" // (Equivalent - ANY is implied.) | ||
// Find projects whose `comments` dictionary property | ||
// have more than one key-value pair. | ||
"comments.@count > $0", 1 | ||
// Find `comments` dictionary properties where ALL | ||
// values are of type 'int'. | ||
"ALL comments.@type == 'int'" | ||
// Find projects whose `comments` dictionary property | ||
// contains only values of type 'string'. | ||
"ALL comments.@type == 'string'" | ||
// Find `comments` dictionary properties where NO | ||
// values are of type 'int'. | ||
// Find projects whose `comments` dictionary property | ||
// contains no values of type 'int'. | ||
"NONE comments.@type == 'int'" | ||
5 changes: 5 additions & 0 deletions
5
...erated/node/v12/formatted/realm-query-language.test.snippet.dot-notation.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.. code-block:: typescript | ||
// Find projects whose `items` list property contains | ||
// an Item object with a specific name. | ||
"items[0].name == 'Approve project plan'" |
7 changes: 7 additions & 0 deletions
7
...ormatted/realm-query-language.test.snippet.equivalent-lists-any-operator.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.. code-block:: typescript | ||
"assignee == ANY { $0, $1 }", "Alex", "Ali" | ||
"assignee == { $0, $1 }", "Alex", "Ali" // Equivalent (ANY is implied.) | ||
"assignee NONE { 'Alex', 'Ali' }" // Equivalent to != ANY. |
2 changes: 2 additions & 0 deletions
2
.../formatted/realm-query-language.test.snippet.list-comparisons-collection.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.. code-block:: typescript | ||
// Find an item with the specified ObjectId value | ||
// in the `items` collection. | ||
"oid(631a072f75120729dc9223d9) IN items._id" |
This file contains 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
2 changes: 2 additions & 0 deletions
2
.../v12/formatted/realm-query-language.test.snippet.list-comparisons-static.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.. code-block:: typescript | ||
// Find items with a priority value matching | ||
// any value in the static list. | ||
"priority IN {0, 1, 2}" |
5 changes: 4 additions & 1 deletion
5
.../generated/node/v12/formatted/realm-query-language.test.snippet.nil-type.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.. code-block:: typescript | ||
"assignee == nil" | ||
"assignee == nil" | ||
// 'null' maps to the SDK language's null pointer | ||
"assignee == $0", null |
3 changes: 0 additions & 3 deletions
3
...nerated/node/v12/formatted/realm-query-language.test.snippet.oid-literal.ts.rst
This file was deleted.
Oops, something went wrong.
17 changes: 16 additions & 1 deletion
17
...mples/generated/node/v12/formatted/realm-query-language.test.snippet.oid.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
.. code-block:: typescript | ||
"_id == oid(6001c033600510df3bbfd864)" | ||
// Find an item whose `_id` matches the ObjectID | ||
// value passed to 'oid()'. | ||
"_id == oid(6001c033600510df3bbfd864)" | ||
// Find an item whose `_id` matches the ObjectID | ||
// passed as a parameterized query argument. | ||
"_id == $0", oidValue | ||
// Find an item whose `id` matches the UUID value | ||
// passed to 'uuid()'. | ||
"id == uuid(d1b186e1-e9e0-4768-a1a7-c492519d47ee)" | ||
// Find an item whose `_id` matches the UUID | ||
// passed as a parameterized query argument. | ||
"id == $0", uuidValue |
This file contains 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 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
12 changes: 12 additions & 0 deletions
12
...tted/realm-query-language.test.snippet.sort-distinct-limit-order-matters.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. code-block:: typescript | ||
// 1. Sorts by highest priority. | ||
// 2. Returns the first item. | ||
// 3. Remove duplicate names (N/A because a single | ||
// item is always considered distinct). | ||
"assignee == null SORT(priority ASC) LIMIT(1) DISTINCT(name)" | ||
// 1. Removes any duplicates by name. | ||
// 2. Sorts by highest priority. | ||
// 3. Returns the first item. | ||
"assignee == null DISTINCT(name) SORT(priority ASC) LIMIT(1)" |
11 changes: 10 additions & 1 deletion
11
...node/v12/formatted/realm-query-language.test.snippet.sort-distinct-limit.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
.. code-block:: typescript | ||
"assignee == 'Ali' SORT(priority DESC) DISTINCT(name) LIMIT(5)" | ||
// Find incomplete items, sort by `priority` | ||
// in descending order, then sort equal `priority` | ||
// values by `progressMinutes` in ascending order. | ||
"isComplete == false SORT(priority DESC, progressMinutes ASC)" | ||
// Find high priority items, then remove from the results | ||
// any items with duplicate `name` AND `assignee` values. | ||
"priority >= 5 DISTINCT(name, assignee)" | ||
// Find in-progress items, then return the first 10 results. | ||
"progressMinutes > 0 && isComplete != true LIMIT(10)" |
20 changes: 14 additions & 6 deletions
20
...ed/node/v12/formatted/realm-query-language.test.snippet.string-operators.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
.. code-block:: typescript | ||
// Find projects whose name starts with the letter 'e' | ||
// (case-insensitive). | ||
"name BEGINSWITH[c] $0", "e" | ||
// Find projects whose name starts with 'E' or 'e' | ||
// (case-insensitive). | ||
"name BEGINSWITH[c] $0", "E" | ||
// Find projects whose name contains the letters 'ie' | ||
// (case-sensitive). | ||
"name CONTAINS $0", "ie" | ||
// Find projects whose name contains 'ie' | ||
// (case-sensitive). | ||
"name CONTAINS $0", "ie" | ||
// Find items where the assignee name is lexicographically | ||
// between 'Ali' and 'Chris' (case-sensitive). | ||
"assignee BETWEEN { $0 , $1 }", "Ali", "Chris" | ||
// Find projects where the street address is lexicographically | ||
// greater than '123 Main St' (case-sensitive). | ||
"projectLocation.address.street > $0", "123 Main St" |
5 changes: 0 additions & 5 deletions
5
...ated/node/v12/formatted/realm-query-language.test.snippet.subquery-count.ts.rst
This file was deleted.
Oops, something went wrong.
8 changes: 6 additions & 2 deletions
8
.../generated/node/v12/formatted/realm-query-language.test.snippet.subquery.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
.. code-block:: typescript | ||
// Find projects with incomplete to-do items assigned to Alex. | ||
"SUBQUERY(items, $item, $item.isComplete == false AND $item.assignee == 'Alex').@count > 0" | ||
// Find projects with incomplete items with 'Demo' in the name. | ||
"SUBQUERY(items, $item, $item.isComplete == false AND $item.name CONTAINS[c] 'Demo').@count > 0" | ||
// Find projects where the number of completed items | ||
// is greater than or equal to the project's `quota` property. | ||
"SUBQUERY(items, $item, $item.isComplete == true).@count >= quota" |
12 changes: 10 additions & 2 deletions
12
...rated/node/v12/formatted/realm-query-language.test.snippet.type-operator.ts.rst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
.. code-block:: typescript | ||
"mixedType.@type == 'string'" | ||
// Find projects with an `additionalInfo` property of | ||
// string type. | ||
"additionalInfo.@type == 'string'" | ||
"mixedType.@type == 'bool'" | ||
// Find projects with an `additionalInfo` property of | ||
// `collection` type, which matches list or dictionary types. | ||
"additionalInfo.@type == 'collection'" | ||
// Find projects with an `additionalInfo` property of | ||
// list type, where any list element is of type 'bool'. | ||
"additionalInfo[*].@type == 'bool'" |
3 changes: 0 additions & 3 deletions
3
...ples/generated/node/v12/formatted/realm-query-language.test.snippet.uuid.ts.rst
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.