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 all 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.
23 changes: 23 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,23 @@
.. note:: Collections in Mixed fields supported in Apps created after May 22, 2024

App Services Apps created *after* May 22, 2024 can store collections

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating this! I think technically this was out in prod on May 29th but I'll defer to @tkaye407 since May 22nd was the official release date

(arrays and dictionaries) of mixed data within a mixed data property.
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 this feature with Atlas Device SDK, you must use the following
minimum SDK versions:

- C++ SDK: version TBD
- Flutter SDK: v2.0.0 or later
- Kotlin SDK: v2.0.0 or later
- .NET SDK: v12.2.0 or later
- Node.js SDK: v12.9.0 or later
- React Native SDK: v12.9.0 or later
- Swift SDK: version TBD

This feature is *not* supported in the Java SDK.

You can contact Support to learn more about enabling this feature in an
existing app using a supported 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