Skip to content

Commit 38333f5

Browse files
committed
Add details about querying custom persistable property
1 parent 71cfa37 commit 38333f5

File tree

7 files changed

+153
-2
lines changed

7 files changed

+153
-2
lines changed
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
You can query a :flutter-sdk:`RealmValue <realm/RealmValue-class.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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The selected language does not currently support type projection.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Queries on SDK Objects
2+
``````````````````````
3+
4+
When working with projected types, queries operate on the persisted type.
5+
However, you can use the mapped types interchangeably with the persisted
6+
types in arguments in most cases. The exception is queries on embedded
7+
objects.
8+
9+
.. tip::
10+
11+
Projected types support :ref:`sorting and aggregates <sdks-filter-data-swift>`
12+
where the persisted type supports them.
13+
14+
Queries on Embedded Objects
15+
```````````````````````````
16+
17+
You can query embedded types on the supported property types within the
18+
object using memberwise equality.
19+
20+
Object link properties support equality comparisons, but do not support
21+
memberwise comparisons. You can query embedded objects for memberwise
22+
equality on all primitive types. You cannot perform memberwise comparison
23+
on objects and collections.
24+
25+
Dynamic APIs
26+
````````````
27+
28+
Because the schema has no concept of custom type mappings, reading data via
29+
any of the dynamic APIs gives the underlying persisted type. The SDK does
30+
support writing mapped types via a dynamic API, and converts the projected
31+
type to the persisted type.
32+
33+
The most common use of the dynamic APIs is migration. You can write projected
34+
types during migration, and the SDK converts the projected type to the persisted
35+
type. However, reading data during a migration gives the underlying persisted
36+
type.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Queries on SDK Objects
2+
``````````````````````
3+
4+
When working with projected types, queries operate on the persisted type.
5+
However, you can use the mapped types interchangeably with the persisted
6+
types in arguments in most cases. The exception is queries on embedded
7+
objects.
8+
9+
.. tip::
10+
11+
Projected types support :ref:`sorting and aggregates <sdks-filter-data-swift>`
12+
where the persisted type supports them.
13+
14+
.. literalinclude:: /examples/generated/code/start/TypeProjection.snippet.query-objects-with-type-projection.swift
15+
:language: swift
16+
17+
Queries on Embedded Objects
18+
```````````````````````````
19+
20+
You can query embedded types on the supported property types within the
21+
object using memberwise equality.
22+
23+
Object link properties support equality comparisons, but do not support
24+
memberwise comparisons. You can query embedded objects for memberwise
25+
equality on all primitive types. You cannot perform memberwise comparison
26+
on objects and collections.
27+
28+
Dynamic APIs
29+
````````````
30+
31+
Because the schema has no concept of custom type mappings, reading data via
32+
any of the dynamic APIs gives the underlying persisted type. The SDK does
33+
support writing mapped types via a dynamic API, and converts the projected
34+
type to the persisted type.
35+
36+
The most common use of the dynamic APIs is migration. You can write projected
37+
types during migration, and the SDK converts the projected type to the persisted
38+
type. However, reading data during a migration gives the underlying persisted
39+
type.

source/sdk/crud/read.txt

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,12 +1463,12 @@ a mixed property the same way you would any property.
14631463
.. tab::
14641464
:tabid: csharp
14651465

1466-
1466+
.. include:: /includes/api-details/csharp/crud/read-query-mixed-properties-description.rst
14671467

14681468
.. tab::
14691469
:tabid: dart
14701470

1471-
1471+
.. include:: /includes/api-details/dart/crud/read-query-mixed-properties-description.rst
14721472

14731473
.. tab::
14741474
:tabid: java
@@ -1530,6 +1530,62 @@ For details about supported operators and list comparisons, refer to the
15301530
Query a Custom Persistable Property
15311531
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15321532

1533+
When you use :ref:`type projection <sdks-type-projection>` to map unsupported
1534+
types to supported types, accessing those properties is often based on the
1535+
persisted type.
1536+
1537+
.. tabs-drivers::
1538+
1539+
.. tab::
1540+
:tabid: cpp-sdk
1541+
1542+
.. include:: /includes/api-details/generic/crud/read-custom-persistable-property-not-supported.rst
1543+
1544+
.. tab::
1545+
:tabid: csharp
1546+
1547+
.. include:: /includes/api-details/generic/crud/read-custom-persistable-property-not-supported.rst
1548+
1549+
.. tab::
1550+
:tabid: dart
1551+
1552+
.. include:: /includes/api-details/generic/crud/read-custom-persistable-property-not-supported.rst
1553+
1554+
.. tab::
1555+
:tabid: java
1556+
1557+
.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst
1558+
1559+
.. tab::
1560+
:tabid: java-kotlin
1561+
1562+
.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst
1563+
1564+
.. tab::
1565+
:tabid: javascript
1566+
1567+
.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst
1568+
1569+
.. tab::
1570+
:tabid: kotlin
1571+
1572+
.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst
1573+
1574+
.. tab::
1575+
:tabid: objectivec
1576+
1577+
.. include:: /includes/api-details/objectivec/crud/read-query-custom-persistable-property-description.rst
1578+
1579+
.. tab::
1580+
:tabid: swift
1581+
1582+
.. include:: /includes/api-details/swift/crud/read-query-custom-persistable-property-description.rst
1583+
1584+
.. tab::
1585+
:tabid: typescript
1586+
1587+
.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst
1588+
15331589
.. _sdks-read-filter-property-behaviors:
15341590

15351591
Filter by Property Behaviors

source/sdk/model-data/property-types.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,8 @@ Other Property Types
9595

9696
Define an Enum Property
9797
~~~~~~~~~~~~~~~~~~~~~~~
98+
99+
.. _sdks-type-projection:
100+
101+
Map Unsupported Types to Supported Types
102+
----------------------------------------

0 commit comments

Comments
 (0)