Skip to content

Commit ad32aa9

Browse files
authored
(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
1 parent ccb45ee commit ad32aa9

File tree

216 files changed

+6508
-55
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+6508
-55
lines changed

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ intersphinx = [
1111
toc_landing_pages = [
1212
# New IA
1313
"/sdk/crud/create",
14+
"/sdk/crud/read",
1415
"/sdk/platforms/android",
1516
"/sdk/platforms/apple",
1617
"/sdk/platforms/unity",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
In C++, the :cpp-sdk:`Results <structrealm_1_1results.html>` type exposes member
2+
functions to work with results. You may want to check the ``.size()`` of a
3+
results set, or access the object at a specific index.
4+
5+
Additionally, you can iterate through the results, or observe a results
6+
set for changes. For more details about observing the results for changes,
7+
refer to :ref:`sdks-react-to-changes`.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C++ does not currently support aggregate operators.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To query for objects of a given type in the database, pass the object type
2+
``YourClassName`` to the :cpp-sdk:`db::objects\<T\> <structrealm_1_1db.html>`
3+
member function.
4+
5+
This returns a :cpp-sdk:`Results <structrealm_1_1results.html>` object
6+
representing all objects of the given type in the database.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
To find objects stored within a database:
2+
3+
1. Query for objects of a given type in the database, pass the object type
4+
``YourClassName`` to the :cpp-sdk:`db::objects <structrealm_1_1db.html>`
5+
member function.
6+
7+
#. Optionally, pass any query conditions to further refine the results:
8+
9+
- Specify a filter to only return objects that meet the condition. If
10+
you don't specify a filter, the SDK returns all objects of the specified
11+
type.
12+
13+
- Specify the sort order for the results.
14+
Because the database is unordered, if you don't include a sort order,
15+
the SDK cannot guarantee the query returns objects in any specific order.
16+
17+
#. Work with the results. Objects may be frozen or live, depending on whether
18+
you queried a frozen or live database, collection, or object.
19+
20+
Note that any retrieved results don't actually hold matching database objects
21+
in memory. Instead, the database uses **direct references**, or pointers.
22+
Database objects in a results collection reference the matched objects, which
23+
map directly to data in the database file. This also means that you can
24+
traverse your graph of an object's :ref:`relationships <sdks-relationships>`
25+
directly through the results of a query.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
To filter data, call the ``.where()`` function on a collection with a valid
2+
query. Currently, C++ supports only a subset of RQL operators.
3+
4+
Supported Query Operators
5+
`````````````````````````
6+
7+
C++ supports the following query operators:
8+
9+
- Equality (``==``, ``!=``)
10+
- Greater than/less than (``>``, ``>=``, ``<``, ``<=``)
11+
- Compound queries (``||``, ``&&``)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
C++ does not provide a dedicated API to find an object by its primary
2+
key. Instead, you can perform a regular query for objects where the primary
3+
key property matches the desired primary key value.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Query operationsn return a :cpp-sdk:`results collection
2+
<structrealm_1_1results.html>`. Results collections may be either live or
3+
frozen.
4+
5+
- **Live results** always contain the latest results of the associated query.
6+
- **Frozen results** represent a snapshot that cannot be modified and doesn't
7+
reflect the latest changes to the database.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
C++ does not provide an API to limit query results. Instead, rely on the
2+
SDK's lazy loading characteristics to implicitly limit the objects in
3+
memory by only accessing the objects you need for an operation.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can iterate and check the values of a realm :cpp-sdk:`map property
2+
<structrealm_1_1managed_3_01std_1_1map_3_01std_1_1string_00_01T_01_4_00_01void_01_4.html>`
3+
as you would a standard C++ `map <https://en.cppreference.com/w/cpp/container/map>`__.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
You can read, query, and sort a :cpp-sdk:`list
2+
<structrealm_1_1managed_3_01std_1_1vector_3_01T_01_5_01_4_01_4.html>` similar
3+
to working with a :cpp-sdk:`results
4+
<structrealm_1_1internal_1_1bridge_1_1results.html>` collection. You can also
5+
work with a list as a results set by calling the ``as_results()`` public member
6+
function of the managed list class.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The C++ ``mixed`` data type is a union-like object that can represent a value
2+
any of the supported types. It is implemented using the class template
3+
`std::variant <https://en.cppreference.com/w/cpp/utility/variant>`__.
4+
This implementation means that a ``mixed`` property holds a value of
5+
one of its alternative types, or in the case of error - no value.
6+
Your app must handle the type when reading mixed properties.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can iterate, check the size of a set, and find values in a
2+
:cpp-sdk:`set property
3+
<structrealm_1_1managed_3_01std_1_1set_3_01T_01_5_01_4_01_4.html>`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The SDK's :cpp-sdk:`realm::results\<T\> <structrealm_1_1results.html>`
2+
collection is a struct representing objects retrieved from queries. A results
3+
collection represents the lazily-evaluated results of a query operation, and
4+
has these characteristics:
5+
6+
- Results are immutable: you cannot manually add or remove elements to or from
7+
the results collection.
8+
- Results have an associated query that determines their contents.
9+
- Results are **live** or **frozen** based on the query source. If they derive
10+
from live objects, the results automatically update when the database
11+
contents change. If they derive from frozen objects, they represent only a
12+
snapshot and do not automatically update.
13+
- You cannot manually initialize an empty results set. Results can only
14+
be initialized:
15+
16+
- As the result of a query.
17+
- From a managed :ref:`list <sdks-read-list>`, using the
18+
:cpp-sdk:`as_results()
19+
<structrealm_1_1managed_3_01std_1_1vector_3_01T_01_5_01_4_01_4.html>`
20+
member funcion.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Unlike using `std::sort <https://en.cppreference.com/w/cpp/algorithm/sort>`__,
2+
the SDK's sort implementation preserves the lazy loading of objects. It does
3+
not pull the entire set of results or list objects into memory, but only
4+
loads them into memory when you access them.
5+
6+
To sort, call the ``.sort()`` function on a list or results set with one or more
7+
:cpp-sdk:`sort_descriptors <structrealm_1_1internal_1_1bridge_1_1sort__descriptor.html>`.
8+
9+
A ``sort_descriptor`` includes:
10+
11+
- The desired key path to sort by, as a string.
12+
- A bool to specify sort order, where``true`` is ascending and ``false``
13+
is descending.
14+
15+
In this example, we sort a results set on ``priority`` in descending order.
16+
17+
.. literalinclude:: /examples/generated/cpp/filter-data.snippet.sort-results-by-single-property.cpp
18+
:language: cpp
19+
20+
You can also sort a list or results set by multiple sort descriptors. In
21+
this example, we sort a list property on ``assignee`` in ascending order,
22+
and then on ``priority`` in descending order.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
In C#, the ``Realm.All<T>()`` method returns an ``IQueryable<T>`` instance.
2+
You can apply additional operators to work with the results.
3+
4+
For a complete list of the available operators, refer to
5+
:dotnet-sdk:`LINQ support <linqsupport.html>` in the API reference.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
In C#, aggregations use the
2+
:dotnet-sdk:`Filter() <reference/Realms.CollectionExtensions.html?q=Filter>`
3+
method, which can be used to create more complex queries that are currently
4+
unsupported by the LINQ provider.
5+
6+
For more information on the available aggregate operators, refer to the
7+
:ref:`Realm Query Language aggregate operator reference <rql-aggregate-operators>`.
8+
9+
The following examples show different ways to aggregate data.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To read all objects of a certain type, call
2+
:dotnet-sdk:`Realm.All\<T\> <reference/Realms.Realm.html#Realms_Realm_All__1>`,
3+
where ``T`` is the SDK object type.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
To find objects stored within a database:
2+
3+
1. Query for objects of a given type in the database. Pass the object type
4+
to the :dotnet-sdk:`Realm.All\<T\> <reference/Realms.Realm.html#Realms_Realm_All__1>`
5+
method.
6+
7+
#. Optionally, pass any query conditions to further refine the results:
8+
9+
- Specify a filter to only return objects that meet the condition. If
10+
you don't specify a filter, the SDK returns all objects of the specified
11+
type.
12+
13+
- Specify the sort order for the results.
14+
Because the database is unordered, if you don't include a sort order,
15+
the SDK cannot guarantee the query returns objects in any specific order.
16+
17+
#. Work with the results. Objects may be frozen or live, depending on whether
18+
you queried a frozen or live database, collection, or object.
19+
20+
Note that any retrieved results don't actually hold matching database objects
21+
in memory. Instead, the database uses **direct references**, or pointers.
22+
Database objects in a results collection reference the matched objects, which
23+
map directly to data in the database file. This also means that you can
24+
traverse your graph of an object's :ref:`relationships <sdks-relationships>`
25+
directly through the results of a query.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
A :dotnet-sdk:`GeoBox <reference/Realms.GeoBox.html>` is a
2+
rectangular shape whose bounds are determined by :dotnet-sdk:`GeoPoint
3+
<reference/Realms.GeoPoint.html>` coordinates for a bottom-left
4+
and a top-right corner.
5+
6+
In C#, you can optionally construct a ``GeoBox`` from a set of four doubles,
7+
which represent:
8+
9+
- ``left``: The longitude of the left edge of the rectangle.
10+
- ``top``: The latitude of the top edge of the rectangle.
11+
- ``right``: The longitude of the right edge of the rectangle.
12+
- ``bottom``: The latitude of the bottom edge of the rectangle.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
A :dotnet-sdk:`GeoCircle <reference/Realms.GeoCircle.html>` is a
2+
circular shape whose bounds originate from a central :dotnet-sdk:`GeoPoint
3+
<reference/Realms.GeoPoint.html>`, and has a size corresponding to
4+
a radius measured in radians. You can use the SDK's convenience
5+
:dotnet-sdk:`Distance <reference/Realms.Distance.html>` structure to
6+
easily work with radii in different units.
7+
8+
You can construct a ``Distance`` with a radius measurement in one of four units:
9+
10+
- ``FromDegrees(double)``
11+
- ``FromKilometers(double)``
12+
- ``FromMiles(double)``
13+
- ``FromRadians(double)``
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
A :dotnet-sdk:`GeoPolygon <reference/Realms.GeoPolygon.html>` is a polygon
2+
shape whose bounds consist of an outer ring, and 0 or more inner holes
3+
to exclude from the geospatial query.
4+
5+
A polygon's outer ring must contain at least three segments. The last
6+
and the first :dotnet-sdk:`GeoPoint <reference/Realms.GeoPoint.html>`
7+
must be the same, which indicates a closed polygon. This means that it takes
8+
at least four ``GeoPoint`` values to construct a polygon.
9+
10+
Inner holes in a ``GeoPolygon`` are optional, and must be entirely contained
11+
within the outer ring. Each ``GeoPoint`` collection in the ``Holes`` collection
12+
must contain at least three segments, with the same rules as the outer ring.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
In C#, you can query a FTS property using either LINQ or RQL.
2+
3+
To query with LINQ, use :dotnet-sdk:`QueryMethods.FullTextSearch
4+
<reference/Realms.QueryMethods.html#Realms_QueryMethods_FullTextSearch_System_String_System_String_>`.
5+
The following examples query the ``Person.Biography`` field.
6+
7+
.. literalinclude:: /examples/generated/dotnet/Indexing.snippet.linq-query-fts.cs
8+
:language: csharp
9+
10+
To query with RQL, use the ``TEXT`` operator. The following example
11+
queries the ``Person.Biography`` field.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
To query, filter, and sort data in the database, use the SDK query engine.
2+
There are two ways to use the query engine with C#:
3+
4+
- :ref:`LINQ Syntax <sdks-dotnet-linq>`
5+
- :ref:`Realm Query Language (RQL) <realm-query-language>`
6+
7+
Use LINQ syntax for querying when possible, as it provides compile-time checks
8+
for queries and aligns with .NET conventions.
9+
10+
Filter Data with LINQ
11+
`````````````````````
12+
13+
To filter data with LINQ syntax, call the :dotnet-sdk:`Where()
14+
<linqsupport.html#restriction-operators>` operator with a
15+
:dotnet-sdk:`Predicate <linqsupport.html#predicate-operations>` that describes
16+
the subset of data you want to access.
17+
18+
.. literalinclude:: /examples/generated/dotnet/QueryEngineExamples.snippet.logical.cs
19+
:language: csharp
20+
21+
Filter Data with RQL
22+
````````````````````
23+
24+
You can also use the :ref:`Realm Query Language <realm-query-language>` (RQL)
25+
to query realms. RQL is a string-based query language used to access the query
26+
engine. When using RQL, you use the
27+
:dotnet-sdk:`Filter() <reference/Realms.CollectionExtensions.html?q=Filter>`
28+
method.
29+
30+
.. important::
31+
32+
Because :ref:`LINQ <sdks-dotnet-linq>` provides compile-time error checking
33+
of queries, you should use it instead of RQL in most cases. If you require
34+
features beyond LINQ's current capabilities, such as using
35+
:ref:`aggregation <rql-aggregate-operators>`, use RQL.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can find a specific item by its primary key using the
2+
:dotnet-sdk:`Find <reference/Realms.Realm.html#Realms_Realm_Find__1_System_String_>`
3+
method. The following example finds a single Project.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:dotnet-sdk:`Query operations <linqsupport.html>`
2+
return an ``IQueryable<T>``, which represents a collection of all objects
3+
of the given type in the database. This collection may be either live or frozen.
4+
5+
- **Live results** always contain the latest results of the associated query.
6+
- **Frozen results** represent a snapshot that cannot be modified and doesn't
7+
reflect the latest changes to the database.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The C# LINQ query engine does not provide an API to limit query results.
2+
Instead, rely on the SDK's lazy loading characteristics to implicitly limit
3+
the objects in memory by only accessing the objects you need for an operation.
4+
5+
If you're using the Realm Query Language query engine with C#, you can use
6+
the :ref:`RQL LIMIT() operator <rql-sort-distinct-limit>` to limit query
7+
results.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
You can query and iterate through a :ref:`RealmDictionary <sdks-dictionary-property-types>`
2+
property as you would an
3+
`IDictionary <https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.idictionary-2?view=net-8.0>`__.
4+
5+
The SDK also provides a convenience method to cast an ``IDictionary<T>`` to an
6+
``IRealmCollection<T>``. To convert a dictionary to an SDK collection, call the
7+
:dotnet-sdk:`AsRealmCollection\<T\>
8+
<reference/Realms.CollectionExtensions.html#Realms_CollectionExtensions_AsRealmCollection__1_System_Collections_Generic_IDictionary_System_String___0__>`
9+
method with the ``IDictionary<T>`` as its argument.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
The SDK provides two specialized non-persistable data types to define shapes:
2+
3+
- :dotnet-sdk:`GeoPoint <reference/Realms.GeoPoint.html>`: A
4+
struct that represents the coordinates of a point formed by a pair of
5+
doubles consisting of these values:
6+
7+
- Latitude: ranges between -90 and 90 degrees, inclusive.
8+
- Longitude: ranges between -180 and 180 degrees, inclusive.
9+
- :dotnet-sdk:`Distance <reference/Realms.Distance.html>`: A helper
10+
struct to represent and convert a distance.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To query an inverse relationship in C#, you cannot use LINQ. Instead, pass a
2+
string predicate using RQL. The following example shows how you could find
3+
all Users who have Items that contain the word "oscillator".
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SDK lists implement the :dotnet-sdk:`IRealmCollection\<T\>
2+
<reference/Realms.IRealmCollection-1.html>` interface, which provides a range
3+
of properties and methods to simplify reading and querying from the list.
4+
You can query an SDK list using the same :ref:`query engines and operators
5+
<sdks-read-query-objects>` as a results set.
6+
7+
The SDK also provides a convenience method to cast an ``IList<T>`` to an
8+
``IRealmCollection<T>``. To convert a list to an SDK collection, call the
9+
:dotnet-sdk:`AsRealmCollection\<T\>
10+
<reference/Realms.CollectionExtensions.html#Realms_CollectionExtensions_AsRealmCollection__1_System_Collections_Generic_IList___0__>`
11+
method with the ``IList<T>`` as its argument.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
You can query a :dotnet-sdk:`RealmValue <reference/Realms.RealmValue.html>`
2+
field just like any other data type. Operators that only work with certain
3+
types, such as string operators and arithmetic operators, ignore
4+
values that do not contain that type. Negating such operators matches
5+
values that do not contain the type. Type queries match the underlying
6+
type, rather than ``RealmValue``. Arithmetic operators convert numeric
7+
values implicitly to compare across types.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SDK sets implement the :dotnet-sdk:`IRealmCollection\<T\>
2+
<reference/Realms.IRealmCollection-1.html>` interface, which provides a range
3+
of properties and methods to simplify reading and querying from the set.
4+
You can query an SDK set using the same :ref:`query engines and operators
5+
<sdks-read-query-objects>` as a results set.
6+
7+
The SDK also provides a convenience method to cast an ``ISet<T>`` to an
8+
``IRealmCollection<T>``. To convert a set to an SDK collection, call the
9+
:dotnet-sdk:`AsRealmCollection\<T\>
10+
<reference/Realms.CollectionExtensions.html#Realms_CollectionExtensions_AsRealmCollection__1_System_Collections_Generic_ISet___0__>`
11+
method with the ``ISet<T>`` as its argument.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
An application could use the following object schemas to indicate
2+
that a Person may own multiple Dogs by including them in its ``dog``
3+
property:
4+
5+
.. literalinclude:: /examples/generated/dotnet/Relationships.snippet.one-to-many.cs
6+
:language: csharp
7+
8+
To see the to-many relationship of Person to Dog, you query for the
9+
Person and get that person's Dogs.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
To query a direct relationship, you can use LINQ syntax.
2+
See the following example for how to query a one-to-one relationship.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
You can query geospatial data in two ways:
2+
3+
- Using the :dotnet-sdk:`GeoWithin()
4+
<reference/Realms.QueryMethods.html#Realms_QueryMethods_GeoWithin_Realms_IEmbeddedObject_Realms_GeoShapeBase_>`
5+
operator with the :ref:`LINQ <sdks-dotnet-linq>` query engine.
6+
- Using the :dotnet-sdk:`Filter()
7+
<reference/Realms.CollectionExtensions.html?q=Filter>` method with the
8+
:ref:`Realm Query Language <rql-geospatial>` ``geoWithin`` operator.
9+
10+
The examples below show the results of queries using these two ``Company``
11+
objects.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
The SDK's results collection is a class representing objects retrieved from
2+
queries. A results collection represents the lazily-evaluated results of a
3+
query operation, and has these characteristics:
4+
5+
- Results are immutable: you cannot manually add or remove elements to or from
6+
the results collection.
7+
- Results have an associated query that determines their contents.
8+
- Results are **live** or **frozen** based on the query source. If they derive
9+
from live objects, the results automatically update when the database
10+
contents change in the isolate context. If they derive from frozen objects,
11+
they represent only a snapshot and do not automatically update.
12+
- You cannot manually initialize an empty results set. Results can
13+
only be initialized as the result of a query.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The following code sorts the projects by name in reverse
2+
alphabetical order (i.e. "descending" order).

0 commit comments

Comments
 (0)