Skip to content

Commit

Permalink
Add details about querying custom persistable property
Browse files Browse the repository at this point in the history
  • Loading branch information
dacharyc committed Aug 9, 2024
1 parent 71cfa37 commit 38333f5
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 2 deletions.
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
You can query a :flutter-sdk:`RealmValue <realm/RealmValue-class.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.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The selected language does not currently support type projection.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Queries on SDK Objects
``````````````````````

When working with projected types, queries operate on the persisted type.
However, you can use the mapped types interchangeably with the persisted
types in arguments in most cases. The exception is queries on embedded
objects.

.. tip::

Projected types support :ref:`sorting and aggregates <sdks-filter-data-swift>`
where the persisted type supports them.

Queries on Embedded Objects
```````````````````````````

You can query embedded types on the supported property types within the
object using memberwise equality.

Object link properties support equality comparisons, but do not support
memberwise comparisons. You can query embedded objects for memberwise
equality on all primitive types. You cannot perform memberwise comparison
on objects and collections.

Dynamic APIs
````````````

Because the schema has no concept of custom type mappings, reading data via
any of the dynamic APIs gives the underlying persisted type. The SDK does
support writing mapped types via a dynamic API, and converts the projected
type to the persisted type.

The most common use of the dynamic APIs is migration. You can write projected
types during migration, and the SDK converts the projected type to the persisted
type. However, reading data during a migration gives the underlying persisted
type.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Queries on SDK Objects
``````````````````````

When working with projected types, queries operate on the persisted type.
However, you can use the mapped types interchangeably with the persisted
types in arguments in most cases. The exception is queries on embedded
objects.

.. tip::

Projected types support :ref:`sorting and aggregates <sdks-filter-data-swift>`
where the persisted type supports them.

.. literalinclude:: /examples/generated/code/start/TypeProjection.snippet.query-objects-with-type-projection.swift
:language: swift

Queries on Embedded Objects
```````````````````````````

You can query embedded types on the supported property types within the
object using memberwise equality.

Object link properties support equality comparisons, but do not support
memberwise comparisons. You can query embedded objects for memberwise
equality on all primitive types. You cannot perform memberwise comparison
on objects and collections.

Dynamic APIs
````````````

Because the schema has no concept of custom type mappings, reading data via
any of the dynamic APIs gives the underlying persisted type. The SDK does
support writing mapped types via a dynamic API, and converts the projected
type to the persisted type.

The most common use of the dynamic APIs is migration. You can write projected
types during migration, and the SDK converts the projected type to the persisted
type. However, reading data during a migration gives the underlying persisted
type.
60 changes: 58 additions & 2 deletions source/sdk/crud/read.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1463,12 +1463,12 @@ a mixed property the same way you would any property.
.. tab::
:tabid: csharp


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

.. tab::
:tabid: dart


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

.. tab::
:tabid: java
Expand Down Expand Up @@ -1530,6 +1530,62 @@ For details about supported operators and list comparisons, refer to the
Query a Custom Persistable Property
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When you use :ref:`type projection <sdks-type-projection>` to map unsupported
types to supported types, accessing those properties is often based on the
persisted type.

.. tabs-drivers::

.. tab::
:tabid: cpp-sdk

.. include:: /includes/api-details/generic/crud/read-custom-persistable-property-not-supported.rst

.. tab::
:tabid: csharp

.. include:: /includes/api-details/generic/crud/read-custom-persistable-property-not-supported.rst

.. tab::
:tabid: dart

.. include:: /includes/api-details/generic/crud/read-custom-persistable-property-not-supported.rst

.. tab::
:tabid: java

.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst

.. tab::
:tabid: java-kotlin

.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst

.. tab::
:tabid: javascript

.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst

.. tab::
:tabid: kotlin

.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst

.. tab::
:tabid: objectivec

.. include:: /includes/api-details/objectivec/crud/read-query-custom-persistable-property-description.rst

.. tab::
:tabid: swift

.. include:: /includes/api-details/swift/crud/read-query-custom-persistable-property-description.rst

.. tab::
:tabid: typescript

.. include:: /includes/api-details/generic/crud/read-query-custom-persistable-property-not-supported.rst

.. _sdks-read-filter-property-behaviors:

Filter by Property Behaviors
Expand Down
5 changes: 5 additions & 0 deletions source/sdk/model-data/property-types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,8 @@ Other Property Types

Define an Enum Property
~~~~~~~~~~~~~~~~~~~~~~~

.. _sdks-type-projection:

Map Unsupported Types to Supported Types
----------------------------------------

0 comments on commit 38333f5

Please sign in to comment.