Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCSP-37133: Collections in Mixed data type #715

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/graphql/expose-data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ field, the field has a ``null`` value in the returned document.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GraphQL requires that all data conforms to a well-defined type, so you
must :ref:`define a schema <enforce-a-schema>` for
must :ref:`enforce-a-schema` for
documents in the collection. App Services automatically generates
:doc:`GraphQL types and resolvers
</graphql/types-and-resolvers>` for documents in the collection
Expand Down
Binary file modified source/images/translate-jsonschema-into-realm-data-model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions source/includes/note-collections-in-mixed-sync.rst
cbullinger marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.. note:: Collections in Mixed fields supported in Apps created after March XX, 2024
cbullinger marked this conversation as resolved.
Show resolved Hide resolved

App Services Apps created *after* March XX, 2024 can store collections
cbullinger marked this conversation as resolved.
Show resolved Hide resolved
cbullinger marked this conversation as resolved.
Show resolved Hide resolved
(arrays and dictionaries) in mixed data properties. You can
nest collections within other collections, which lets you store complex data
structures such as JSON or MongoDB documents without having to define a
strict data model.

To use feature with Atlas Device SDK, you must use :ref:`Flutter SDK v2.0.0 or later <flutter-realm-value>`. Support for other SDKs will be added in future releases.
cbullinger marked this conversation as resolved.
Show resolved Hide resolved

If your App was created before March XX, 2024, you can contact support to
learn more about enabling this feature.

.. TODO: Update this note with SDK versions once they release
.. To use this feature with an Atlas Device SDK, you must use the following
SDK versions:
.. - C++ SDK v1.0.0 or later
.. - Flutter SDK v2.0.0 or later
.. - Kotlin SDK v1.0.0 or later
.. - .NET SDK v1.0.0 or later
.. - Node.js SDK v1.0.0 or later
.. - React Native SDK v1.0.0 or later
.. - Swift SDK v1.0.0 or later
.. - This feature is *not* supported in the Java SDK
11 changes: 8 additions & 3 deletions source/schemas.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
Schemas
=======

.. default-domain:: mongodb
.. meta::
:description: Learn about Atlas App Services Schemas.

.. facet::
:name: genre
:values: reference

.. contents:: On this page
:local:
Expand All @@ -15,9 +20,9 @@ Schemas
.. toctree::
:titlesonly:

Enforce a Schema </schemas/enforce-a-schema>
Define & Enforce a Schema </schemas/enforce-a-schema>
Remove a Schema </schemas/remove-a-schema>
Schema Types </schemas/types>
Schema Data Types </schemas/types>

Overview
--------
Expand Down
44 changes: 32 additions & 12 deletions source/schemas/enforce-a-schema.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
.. _enforce-a-schema:
.. _define-a-schema:

================
Enforce a Schema
================
=========================
Define & Enforce a Schema
=========================

.. default-domain:: mongodb
.. meta::
:keywords: code example
:description: Learn how to create and deploy an Atlas App Services Schema and define validation rules to enforce it.

.. facet::
:name: genre
:values: reference

.. facet::
:name: programming_language
:values: json

.. contents:: On this page
:local:
Expand All @@ -25,8 +36,16 @@ MongoDB Atlas collection.

.. include:: /includes/adf-rules-note.rst

Procedure
---------
Define a Schema
---------------

You can define a schema for a collection in the App Services UI or with the
App Services CLI.

When using the App Services UI, you can choose to:

- Generate a schema from existing data in the collection, and modify as needed.
- Define a schema manually by adding field-level schema definitions.

.. tabs-realm-admin-interfaces::

Expand All @@ -46,11 +65,11 @@ Procedure
configuration screen.


.. step:: Generate a Schema
.. step:: Generate a Schema from Existing Data (Optional)

If you already have data in your collection, App Services can
sample a subset of the documents in the collection and generate a
schema for you based on the sample. This step is optional, so if you
schema for you based on the sample. If you
already have a schema or prefer to define one manually, skip this
step.

Expand Down Expand Up @@ -80,7 +99,9 @@ Procedure
:alt: The Generate Schema sample size input in the App Services UI


.. step:: Add Field-Level Schema Definitions
.. step:: Define or Modify the Schema

You can define a schema manually or modify an existing schema by adding field-level schema definitions.

You may define a single BSON schema for each collection. The root-level type
of each collection schema is an ``object`` schema that represents a document
Expand Down Expand Up @@ -149,8 +170,7 @@ Procedure
}
}


.. step:: Add Change Validation Expressions
.. step:: Add Change Validation Expressions (Optional)

In addition to configuring the content of each field, you can validate changes
to documents by defining a validation :ref:`expression <expressions>` in the
Expand Down Expand Up @@ -308,7 +328,7 @@ Procedure
}


.. step:: Define Change Validation
.. step:: Define Change Validation (Optional)

You can validate changes to documents by defining a validation
:ref:`expression <expressions>` in the ``validate`` field of a schema.
Expand Down
Loading
Loading