-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(DOCSP-39514): Consolidate Read page (#3357)
## Pull Request Info - SDK Docs Consolidation Jira ticket: https://jira.mongodb.org/browse/DOCSP-39514 *Staged Page* - [Read](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39514/sdk/crud/read/) - [Read Properties](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39514/sdk/crud/read/read-properties/) - [Fluent Interface (Java SDK)](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39514/sdk/crud/query-engines/filter-data-java-sdk/): Port content, update Realm naming, and change to use the Drivers tab languages so it preserves a language selection when clicking into the page - [LINQ (.NET SDK)](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39514/sdk/crud/query-engines/filter-data-linq/): Port LINQ content, update Realm naming, omit stuff about querying with RQL as that is generally surfaced in the C# API descriptions on the Read page *Page Source* Add links to every SDK's pages where you got the SDK-specific information: - [C++: Read](https://www.mongodb.com/docs/atlas/device-sdks/sdk/cpp/crud/read/) - [Flutter: Read](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/crud/read/) - [Flutter: Model Data/Results](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/realm-database/model-data/data-types/#realmresults) - [Flutter: Model Data/Geospatial Data](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/realm-database/model-data/geospatial/) - [Java: Read](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/crud/read/) - [Java: Filter Data](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/crud/filter-data/) - [Java: Model Data/Results](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/model-data/data-types/collections/#results-collections) - [Java: Data Types/Mixed (Queries)](https://www.mongodb.com/docs/atlas/device-sdks/sdk/java/model-data/data-types/realmany/#queries) - [Kotlin: Read](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/realm-database/crud/read/) - [Kotlin: Model Data/Geospatial Data](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/realm-database/schemas/geospatials/) - [.NET: Read](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/crud/read/) - [.NET: Filter Data](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/crud/filter/) - [.NET: Results Collections](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/model-data/data-types/collections/) - [.NET: Geospatial Data](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/model-data/data-types/geospatials/) - [Node.js: Read](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/crud/read/) - [Node.js: Collections (info about Results)](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/model-data/data-types/collections/) - [Node.js: Relationships (Inverse relationship info](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/model-data/relationships-and-embedded-objects/) - [Node.js: Data Types/Dictionaries (Query)](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/model-data/data-types/dictionaries/#query-for-objects-with-a-dictionary-property) - [Node.js: Data Types/Sets (info relevant to reading set properties)](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/model-data/data-types/sets/) - [Node.js: Data Types/Mixed (Query)](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/model-data/data-types/mixed/#query-for-objects-with-a-mixed-value) - [Node.js: Data Types/Geospatial (Query)](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/model-data/data-types/geospatial/#query-geospatial-data) - [Swift: Read](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/crud/read/) - [Swift: Supported Types: Results & Sectioned Results](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/model-data/supported-types/#results-and-sectioned-results) ### PR Author Checklist Before requesting a review for your PR, please check these items: - [x] Open the PR against the `feature-consolidated-sdk-docs` branch instead of `master` - [x] Tag the consolidated page for: - genre - meta.keywords - meta.description #### Naming - [x] Update Realm naming and the language around persistence layer/local/device per [this document](https://docs.google.com/document/d/126OczVxBWAwZ4P5ZsSM29WI3REvONEr1ald-mAwPtyQ/edit?usp=sharing) - [x] Include `.rst` files comply with [the naming guidelines](https://docs.google.com/document/d/1h8cr66zoEVeXytVfvDxlCSsUS5IZwvUQvfSCEXNMpek/edit#heading=h.ulh8b5f2hu9) #### Links and Refs - [x] Create new consolidated SDK ref targets starting with "_sdks-" for relevant sections - [x] Remove or update any SDK-specific refs to use the new consolidated SDK ref targets - [x] [Update any Kotlin API links](https://jira.mongodb.org/browse/DOCSP-32519) to use the new Kotlin SDK roles #### Content - [x] Shared code boxes have snippets or placeholders for all 9 languages - [x] API description sections have API details or a generic placeholder for all 9 languages - [x] Check related pages for relevant content to include - [x] Create a ticket for missing examples in each relevant SDK: Consolidation Gaps epic ### Reviewer Checklist As a reviewer, please check these items: - [ ] Shared code example boxes contain language-specific snippets or placeholders for every language - [ ] API reference details contain working API reference links or generic content - [ ] Realm naming/language has been updated - [ ] All relevant content from individual SDK pages is present on the consolidated page
- Loading branch information
Showing
216 changed files
with
6,508 additions
and
55 deletions.
There are no files selected for viewing
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
7 changes: 7 additions & 0 deletions
7
source/includes/api-details/cpp/crud/read-access-results-description.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 @@ | ||
In C++, the :cpp-sdk:`Results <structrealm_1_1results.html>` type exposes member | ||
functions to work with results. You may want to check the ``.size()`` of a | ||
results set, or access the object at a specific index. | ||
|
||
Additionally, you can iterate through the results, or observe a results | ||
set for changes. For more details about observing the results for changes, | ||
refer to :ref:`sdks-react-to-changes`. |
1 change: 1 addition & 0 deletions
1
source/includes/api-details/cpp/crud/read-aggregate-not-supported.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 @@ | ||
C++ does not currently support aggregate operators. |
6 changes: 6 additions & 0 deletions
6
source/includes/api-details/cpp/crud/read-all-objects-of-type-description.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,6 @@ | ||
To query for objects of a given type in the database, pass the object type | ||
``YourClassName`` to the :cpp-sdk:`db::objects\<T\> <structrealm_1_1db.html>` | ||
member function. | ||
|
||
This returns a :cpp-sdk:`Results <structrealm_1_1results.html>` object | ||
representing all objects of the given type in the database. |
25 changes: 25 additions & 0 deletions
25
source/includes/api-details/cpp/crud/read-database-objects-procedure.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,25 @@ | ||
To find objects stored within a database: | ||
|
||
1. Query for objects of a given type in the database, pass the object type | ||
``YourClassName`` to the :cpp-sdk:`db::objects <structrealm_1_1db.html>` | ||
member function. | ||
|
||
#. Optionally, pass any query conditions to further refine the results: | ||
|
||
- Specify a filter to only return objects that meet the condition. If | ||
you don't specify a filter, the SDK returns all objects of the specified | ||
type. | ||
|
||
- Specify the sort order for the results. | ||
Because the database is unordered, if you don't include a sort order, | ||
the SDK cannot guarantee the query returns objects in any specific order. | ||
|
||
#. Work with the results. Objects may be frozen or live, depending on whether | ||
you queried a frozen or live database, collection, or object. | ||
|
||
Note that any retrieved results don't actually hold matching database objects | ||
in memory. Instead, the database uses **direct references**, or pointers. | ||
Database objects in a results collection reference the matched objects, which | ||
map directly to data in the database file. This also means that you can | ||
traverse your graph of an object's :ref:`relationships <sdks-relationships>` | ||
directly through the results of a query. |
11 changes: 11 additions & 0 deletions
11
source/includes/api-details/cpp/crud/read-filter-or-query-objects-description.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,11 @@ | ||
To filter data, call the ``.where()`` function on a collection with a valid | ||
query. Currently, C++ supports only a subset of RQL operators. | ||
|
||
Supported Query Operators | ||
````````````````````````` | ||
|
||
C++ supports the following query operators: | ||
|
||
- Equality (``==``, ``!=``) | ||
- Greater than/less than (``>``, ``>=``, ``<``, ``<=``) | ||
- Compound queries (``||``, ``&&``) |
3 changes: 3 additions & 0 deletions
3
...includes/api-details/cpp/crud/read-find-object-by-primary-key-not-supported.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,3 @@ | ||
C++ does not provide a dedicated API to find an object by its primary | ||
key. Instead, you can perform a regular query for objects where the primary | ||
key property matches the desired primary key value. |
7 changes: 7 additions & 0 deletions
7
source/includes/api-details/cpp/crud/read-intro-description.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 @@ | ||
Query operationsn return a :cpp-sdk:`results collection | ||
<structrealm_1_1results.html>`. Results collections may be either live or | ||
frozen. | ||
|
||
- **Live results** always contain the latest results of the associated query. | ||
- **Frozen results** represent a snapshot that cannot be modified and doesn't | ||
reflect the latest changes to the database. |
3 changes: 3 additions & 0 deletions
3
source/includes/api-details/cpp/crud/read-limit-not-supported.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,3 @@ | ||
C++ does not provide an API to limit query results. Instead, rely on the | ||
SDK's lazy loading characteristics to implicitly limit the objects in | ||
memory by only accessing the objects you need for an operation. |
3 changes: 3 additions & 0 deletions
3
.../includes/api-details/cpp/crud/read-query-dictionary-properties-description.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,3 @@ | ||
You can iterate and check the values of a realm :cpp-sdk:`map property | ||
<structrealm_1_1managed_3_01std_1_1map_3_01std_1_1string_00_01T_01_4_00_01void_01_4.html>` | ||
as you would a standard C++ `map <https://en.cppreference.com/w/cpp/container/map>`__. |
6 changes: 6 additions & 0 deletions
6
source/includes/api-details/cpp/crud/read-query-list-properties-description.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,6 @@ | ||
You can read, query, and sort a :cpp-sdk:`list | ||
<structrealm_1_1managed_3_01std_1_1vector_3_01T_01_5_01_4_01_4.html>` similar | ||
to working with a :cpp-sdk:`results | ||
<structrealm_1_1internal_1_1bridge_1_1results.html>` collection. You can also | ||
work with a list as a results set by calling the ``as_results()`` public member | ||
function of the managed list class. |
6 changes: 6 additions & 0 deletions
6
source/includes/api-details/cpp/crud/read-query-mixed-properties-description.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,6 @@ | ||
The C++ ``mixed`` data type is a union-like object that can represent a value | ||
any of the supported types. It is implemented using the class template | ||
`std::variant <https://en.cppreference.com/w/cpp/utility/variant>`__. | ||
This implementation means that a ``mixed`` property holds a value of | ||
one of its alternative types, or in the case of error - no value. | ||
Your app must handle the type when reading mixed properties. |
3 changes: 3 additions & 0 deletions
3
source/includes/api-details/cpp/crud/read-query-set-properties-description.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,3 @@ | ||
You can iterate, check the size of a set, and find values in a | ||
:cpp-sdk:`set property | ||
<structrealm_1_1managed_3_01std_1_1set_3_01T_01_5_01_4_01_4.html>`. |
20 changes: 20 additions & 0 deletions
20
source/includes/api-details/cpp/crud/read-sdk-results-collections-description.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,20 @@ | ||
The SDK's :cpp-sdk:`realm::results\<T\> <structrealm_1_1results.html>` | ||
collection is a struct representing objects retrieved from queries. A results | ||
collection represents the lazily-evaluated results of a query operation, and | ||
has these characteristics: | ||
|
||
- Results are immutable: you cannot manually add or remove elements to or from | ||
the results collection. | ||
- Results have an associated query that determines their contents. | ||
- Results are **live** or **frozen** based on the query source. If they derive | ||
from live objects, the results automatically update when the database | ||
contents change. If they derive from frozen objects, they represent only a | ||
snapshot and do not automatically update. | ||
- You cannot manually initialize an empty results set. Results can only | ||
be initialized: | ||
|
||
- As the result of a query. | ||
- From a managed :ref:`list <sdks-read-list>`, using the | ||
:cpp-sdk:`as_results() | ||
<structrealm_1_1managed_3_01std_1_1vector_3_01T_01_5_01_4_01_4.html>` | ||
member funcion. |
22 changes: 22 additions & 0 deletions
22
source/includes/api-details/cpp/crud/read-sort-description.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,22 @@ | ||
Unlike using `std::sort <https://en.cppreference.com/w/cpp/algorithm/sort>`__, | ||
the SDK's sort implementation preserves the lazy loading of objects. It does | ||
not pull the entire set of results or list objects into memory, but only | ||
loads them into memory when you access them. | ||
|
||
To sort, call the ``.sort()`` function on a list or results set with one or more | ||
:cpp-sdk:`sort_descriptors <structrealm_1_1internal_1_1bridge_1_1sort__descriptor.html>`. | ||
|
||
A ``sort_descriptor`` includes: | ||
|
||
- The desired key path to sort by, as a string. | ||
- A bool to specify sort order, where``true`` is ascending and ``false`` | ||
is descending. | ||
|
||
In this example, we sort a results set on ``priority`` in descending order. | ||
|
||
.. literalinclude:: /examples/generated/cpp/filter-data.snippet.sort-results-by-single-property.cpp | ||
:language: cpp | ||
|
||
You can also sort a list or results set by multiple sort descriptors. In | ||
this example, we sort a list property on ``assignee`` in ascending order, | ||
and then on ``priority`` in descending order. |
5 changes: 5 additions & 0 deletions
5
source/includes/api-details/csharp/crud/read-access-results-description.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 @@ | ||
In C#, the ``Realm.All<T>()`` method returns an ``IQueryable<T>`` instance. | ||
You can apply additional operators to work with the results. | ||
|
||
For a complete list of the available operators, refer to | ||
:dotnet-sdk:`LINQ support <linqsupport.html>` in the API reference. |
9 changes: 9 additions & 0 deletions
9
source/includes/api-details/csharp/crud/read-aggregate-description.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,9 @@ | ||
In C#, aggregations use the | ||
:dotnet-sdk:`Filter() <reference/Realms.CollectionExtensions.html?q=Filter>` | ||
method, which can be used to create more complex queries that are currently | ||
unsupported by the LINQ provider. | ||
|
||
For more information on the available aggregate operators, refer to the | ||
:ref:`Realm Query Language aggregate operator reference <rql-aggregate-operators>`. | ||
|
||
The following examples show different ways to aggregate data. |
3 changes: 3 additions & 0 deletions
3
source/includes/api-details/csharp/crud/read-all-objects-of-type-description.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,3 @@ | ||
To read all objects of a certain type, call | ||
:dotnet-sdk:`Realm.All\<T\> <reference/Realms.Realm.html#Realms_Realm_All__1>`, | ||
where ``T`` is the SDK object type. |
25 changes: 25 additions & 0 deletions
25
source/includes/api-details/csharp/crud/read-database-objects-procedure.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,25 @@ | ||
To find objects stored within a database: | ||
|
||
1. Query for objects of a given type in the database. Pass the object type | ||
to the :dotnet-sdk:`Realm.All\<T\> <reference/Realms.Realm.html#Realms_Realm_All__1>` | ||
method. | ||
|
||
#. Optionally, pass any query conditions to further refine the results: | ||
|
||
- Specify a filter to only return objects that meet the condition. If | ||
you don't specify a filter, the SDK returns all objects of the specified | ||
type. | ||
|
||
- Specify the sort order for the results. | ||
Because the database is unordered, if you don't include a sort order, | ||
the SDK cannot guarantee the query returns objects in any specific order. | ||
|
||
#. Work with the results. Objects may be frozen or live, depending on whether | ||
you queried a frozen or live database, collection, or object. | ||
|
||
Note that any retrieved results don't actually hold matching database objects | ||
in memory. Instead, the database uses **direct references**, or pointers. | ||
Database objects in a results collection reference the matched objects, which | ||
map directly to data in the database file. This also means that you can | ||
traverse your graph of an object's :ref:`relationships <sdks-relationships>` | ||
directly through the results of a query. |
12 changes: 12 additions & 0 deletions
12
...ludes/api-details/csharp/crud/read-define-geospatial-shapes-box-description.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 @@ | ||
A :dotnet-sdk:`GeoBox <reference/Realms.GeoBox.html>` is a | ||
rectangular shape whose bounds are determined by :dotnet-sdk:`GeoPoint | ||
<reference/Realms.GeoPoint.html>` coordinates for a bottom-left | ||
and a top-right corner. | ||
|
||
In C#, you can optionally construct a ``GeoBox`` from a set of four doubles, | ||
which represent: | ||
|
||
- ``left``: The longitude of the left edge of the rectangle. | ||
- ``top``: The latitude of the top edge of the rectangle. | ||
- ``right``: The longitude of the right edge of the rectangle. | ||
- ``bottom``: The latitude of the bottom edge of the rectangle. |
13 changes: 13 additions & 0 deletions
13
...es/api-details/csharp/crud/read-define-geospatial-shapes-circle-description.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,13 @@ | ||
A :dotnet-sdk:`GeoCircle <reference/Realms.GeoCircle.html>` is a | ||
circular shape whose bounds originate from a central :dotnet-sdk:`GeoPoint | ||
<reference/Realms.GeoPoint.html>`, and has a size corresponding to | ||
a radius measured in radians. You can use the SDK's convenience | ||
:dotnet-sdk:`Distance <reference/Realms.Distance.html>` structure to | ||
easily work with radii in different units. | ||
|
||
You can construct a ``Distance`` with a radius measurement in one of four units: | ||
|
||
- ``FromDegrees(double)`` | ||
- ``FromKilometers(double)`` | ||
- ``FromMiles(double)`` | ||
- ``FromRadians(double)`` |
12 changes: 12 additions & 0 deletions
12
...s/api-details/csharp/crud/read-define-geospatial-shapes-polygon-description.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 @@ | ||
A :dotnet-sdk:`GeoPolygon <reference/Realms.GeoPolygon.html>` is a polygon | ||
shape whose bounds consist of an outer ring, and 0 or more inner holes | ||
to exclude from the geospatial query. | ||
|
||
A polygon's outer ring must contain at least three segments. The last | ||
and the first :dotnet-sdk:`GeoPoint <reference/Realms.GeoPoint.html>` | ||
must be the same, which indicates a closed polygon. This means that it takes | ||
at least four ``GeoPoint`` values to construct a polygon. | ||
|
||
Inner holes in a ``GeoPolygon`` are optional, and must be entirely contained | ||
within the outer ring. Each ``GeoPoint`` collection in the ``Holes`` collection | ||
must contain at least three segments, with the same rules as the outer ring. |
11 changes: 11 additions & 0 deletions
11
...s/api-details/csharp/crud/read-filter-full-text-search-property-description.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,11 @@ | ||
In C#, you can query a FTS property using either LINQ or RQL. | ||
|
||
To query with LINQ, use :dotnet-sdk:`QueryMethods.FullTextSearch | ||
<reference/Realms.QueryMethods.html#Realms_QueryMethods_FullTextSearch_System_String_System_String_>`. | ||
The following examples query the ``Person.Biography`` field. | ||
|
||
.. literalinclude:: /examples/generated/dotnet/Indexing.snippet.linq-query-fts.cs | ||
:language: csharp | ||
|
||
To query with RQL, use the ``TEXT`` operator. The following example | ||
queries the ``Person.Biography`` field. |
35 changes: 35 additions & 0 deletions
35
...e/includes/api-details/csharp/crud/read-filter-or-query-objects-description.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,35 @@ | ||
To query, filter, and sort data in the database, use the SDK query engine. | ||
There are two ways to use the query engine with C#: | ||
|
||
- :ref:`LINQ Syntax <sdks-dotnet-linq>` | ||
- :ref:`Realm Query Language (RQL) <realm-query-language>` | ||
|
||
Use LINQ syntax for querying when possible, as it provides compile-time checks | ||
for queries and aligns with .NET conventions. | ||
|
||
Filter Data with LINQ | ||
````````````````````` | ||
|
||
To filter data with LINQ syntax, call the :dotnet-sdk:`Where() | ||
<linqsupport.html#restriction-operators>` operator with a | ||
:dotnet-sdk:`Predicate <linqsupport.html#predicate-operations>` that describes | ||
the subset of data you want to access. | ||
|
||
.. literalinclude:: /examples/generated/dotnet/QueryEngineExamples.snippet.logical.cs | ||
:language: csharp | ||
|
||
Filter Data with RQL | ||
```````````````````` | ||
|
||
You can also use the :ref:`Realm Query Language <realm-query-language>` (RQL) | ||
to query realms. RQL is a string-based query language used to access the query | ||
engine. When using RQL, you use the | ||
:dotnet-sdk:`Filter() <reference/Realms.CollectionExtensions.html?q=Filter>` | ||
method. | ||
|
||
.. important:: | ||
|
||
Because :ref:`LINQ <sdks-dotnet-linq>` provides compile-time error checking | ||
of queries, you should use it instead of RQL in most cases. If you require | ||
features beyond LINQ's current capabilities, such as using | ||
:ref:`aggregation <rql-aggregate-operators>`, use RQL. |
3 changes: 3 additions & 0 deletions
3
...ncludes/api-details/csharp/crud/read-find-object-by-primary-key-description.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,3 @@ | ||
You can find a specific item by its primary key using the | ||
:dotnet-sdk:`Find <reference/Realms.Realm.html#Realms_Realm_Find__1_System_String_>` | ||
method. The following example finds a single Project. |
7 changes: 7 additions & 0 deletions
7
source/includes/api-details/csharp/crud/read-intro-description.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 @@ | ||
:dotnet-sdk:`Query operations <linqsupport.html>` | ||
return an ``IQueryable<T>``, which represents a collection of all objects | ||
of the given type in the database. This collection may be either live or frozen. | ||
|
||
- **Live results** always contain the latest results of the associated query. | ||
- **Frozen results** represent a snapshot that cannot be modified and doesn't | ||
reflect the latest changes to the database. |
7 changes: 7 additions & 0 deletions
7
source/includes/api-details/csharp/crud/read-limit-description.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 @@ | ||
The C# LINQ query engine does not provide an API to limit query results. | ||
Instead, rely on the SDK's lazy loading characteristics to implicitly limit | ||
the objects in memory by only accessing the objects you need for an operation. | ||
|
||
If you're using the Realm Query Language query engine with C#, you can use | ||
the :ref:`RQL LIMIT() operator <rql-sort-distinct-limit>` to limit query | ||
results. |
9 changes: 9 additions & 0 deletions
9
...cludes/api-details/csharp/crud/read-query-dictionary-properties-description.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,9 @@ | ||
You can query and iterate through a :ref:`RealmDictionary <sdks-dictionary-property-types>` | ||
property as you would an | ||
`IDictionary <https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.idictionary-2?view=net-8.0>`__. | ||
|
||
The SDK also provides a convenience method to cast an ``IDictionary<T>`` to an | ||
``IRealmCollection<T>``. To convert a dictionary to an SDK collection, call the | ||
:dotnet-sdk:`AsRealmCollection\<T\> | ||
<reference/Realms.CollectionExtensions.html#Realms_CollectionExtensions_AsRealmCollection__1_System_Collections_Generic_IDictionary_System_String___0__>` | ||
method with the ``IDictionary<T>`` as its argument. |
10 changes: 10 additions & 0 deletions
10
source/includes/api-details/csharp/crud/read-query-geospatial-data-description.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,10 @@ | ||
The SDK provides two specialized non-persistable data types to define shapes: | ||
|
||
- :dotnet-sdk:`GeoPoint <reference/Realms.GeoPoint.html>`: A | ||
struct that represents the coordinates of a point formed by a pair of | ||
doubles consisting of these values: | ||
|
||
- Latitude: ranges between -90 and 90 degrees, inclusive. | ||
- Longitude: ranges between -180 and 180 degrees, inclusive. | ||
- :dotnet-sdk:`Distance <reference/Realms.Distance.html>`: A helper | ||
struct to represent and convert a distance. |
3 changes: 3 additions & 0 deletions
3
...ncludes/api-details/csharp/crud/read-query-inverse-relationship-description.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,3 @@ | ||
To query an inverse relationship in C#, you cannot use LINQ. Instead, pass a | ||
string predicate using RQL. The following example shows how you could find | ||
all Users who have Items that contain the word "oscillator". |
11 changes: 11 additions & 0 deletions
11
source/includes/api-details/csharp/crud/read-query-list-properties-description.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,11 @@ | ||
SDK lists implement the :dotnet-sdk:`IRealmCollection\<T\> | ||
<reference/Realms.IRealmCollection-1.html>` interface, which provides a range | ||
of properties and methods to simplify reading and querying from the list. | ||
You can query an SDK list using the same :ref:`query engines and operators | ||
<sdks-read-query-objects>` as a results set. | ||
|
||
The SDK also provides a convenience method to cast an ``IList<T>`` to an | ||
``IRealmCollection<T>``. To convert a list to an SDK collection, call the | ||
:dotnet-sdk:`AsRealmCollection\<T\> | ||
<reference/Realms.CollectionExtensions.html#Realms_CollectionExtensions_AsRealmCollection__1_System_Collections_Generic_IList___0__>` | ||
method with the ``IList<T>`` as its argument. |
7 changes: 7 additions & 0 deletions
7
...ce/includes/api-details/csharp/crud/read-query-mixed-properties-description.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 @@ | ||
You can query a :dotnet-sdk:`RealmValue <reference/Realms.RealmValue.html>` | ||
field just like any other data type. Operators that only work with certain | ||
types, such as string operators and arithmetic operators, ignore | ||
values that do not contain that type. Negating such operators matches | ||
values that do not contain the type. Type queries match the underlying | ||
type, rather than ``RealmValue``. Arithmetic operators convert numeric | ||
values implicitly to compare across types. |
11 changes: 11 additions & 0 deletions
11
source/includes/api-details/csharp/crud/read-query-set-properties-description.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,11 @@ | ||
SDK sets implement the :dotnet-sdk:`IRealmCollection\<T\> | ||
<reference/Realms.IRealmCollection-1.html>` interface, which provides a range | ||
of properties and methods to simplify reading and querying from the set. | ||
You can query an SDK set using the same :ref:`query engines and operators | ||
<sdks-read-query-objects>` as a results set. | ||
|
||
The SDK also provides a convenience method to cast an ``ISet<T>`` to an | ||
``IRealmCollection<T>``. To convert a set to an SDK collection, call the | ||
:dotnet-sdk:`AsRealmCollection\<T\> | ||
<reference/Realms.CollectionExtensions.html#Realms_CollectionExtensions_AsRealmCollection__1_System_Collections_Generic_ISet___0__>` | ||
method with the ``ISet<T>`` as its argument. |
9 changes: 9 additions & 0 deletions
9
...ncludes/api-details/csharp/crud/read-query-to-many-relationship-description.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,9 @@ | ||
An application could use the following object schemas to indicate | ||
that a Person may own multiple Dogs by including them in its ``dog`` | ||
property: | ||
|
||
.. literalinclude:: /examples/generated/dotnet/Relationships.snippet.one-to-many.cs | ||
:language: csharp | ||
|
||
To see the to-many relationship of Person to Dog, you query for the | ||
Person and get that person's Dogs. |
2 changes: 2 additions & 0 deletions
2
...includes/api-details/csharp/crud/read-query-to-one-relationship-description.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,2 @@ | ||
To query a direct relationship, you can use LINQ syntax. | ||
See the following example for how to query a one-to-one relationship. |
11 changes: 11 additions & 0 deletions
11
...ludes/api-details/csharp/crud/read-query-with-geospatial-shapes-description.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,11 @@ | ||
You can query geospatial data in two ways: | ||
|
||
- Using the :dotnet-sdk:`GeoWithin() | ||
<reference/Realms.QueryMethods.html#Realms_QueryMethods_GeoWithin_Realms_IEmbeddedObject_Realms_GeoShapeBase_>` | ||
operator with the :ref:`LINQ <sdks-dotnet-linq>` query engine. | ||
- Using the :dotnet-sdk:`Filter() | ||
<reference/Realms.CollectionExtensions.html?q=Filter>` method with the | ||
:ref:`Realm Query Language <rql-geospatial>` ``geoWithin`` operator. | ||
|
||
The examples below show the results of queries using these two ``Company`` | ||
objects. |
13 changes: 13 additions & 0 deletions
13
...e/includes/api-details/csharp/crud/read-sdk-results-collections-description.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,13 @@ | ||
The SDK's results collection is a class representing objects retrieved from | ||
queries. A results collection represents the lazily-evaluated results of a | ||
query operation, and has these characteristics: | ||
|
||
- Results are immutable: you cannot manually add or remove elements to or from | ||
the results collection. | ||
- Results have an associated query that determines their contents. | ||
- Results are **live** or **frozen** based on the query source. If they derive | ||
from live objects, the results automatically update when the database | ||
contents change in the isolate context. If they derive from frozen objects, | ||
they represent only a snapshot and do not automatically update. | ||
- You cannot manually initialize an empty results set. Results can | ||
only be initialized as the result of a query. |
2 changes: 2 additions & 0 deletions
2
source/includes/api-details/csharp/crud/read-sort-description.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,2 @@ | ||
The following code sorts the projects by name in reverse | ||
alphabetical order (i.e. "descending" order). |
Oops, something went wrong.