From 1b4debae172c2129a885f21aeb1c1b8459109986 Mon Sep 17 00:00:00 2001 From: Mohammad Hunan Chughtai Date: Tue, 11 May 2021 11:51:24 -0400 Subject: [PATCH] Revert "(DOCSP-14569): mixed data type (#1057)" This reverts commit d8fec4643a1fa8aa378ad49e4b1860ad7c76c93e. --- examples/node/Examples/data-types.js | 63 ------------------ ...eblock.create-objects-with-mixed-values.js | 20 ------ ...-types.codeblock.define-mixed-in-schema.js | 7 -- ...deblock.query-objects-with-mixed-values.js | 4 -- source/sdk/node.txt | 1 - source/sdk/node/data-types.txt | 29 --------- source/sdk/node/data-types/collections.txt | 16 ----- source/sdk/node/data-types/dictionaries.txt | 18 ----- .../sdk/node/data-types/embedded-objects.txt | 13 ---- source/sdk/node/data-types/field-types.txt | 16 ----- source/sdk/node/data-types/mixed.txt | 65 ------------------- source/sdk/node/data-types/sets.txt | 18 ----- source/sdk/node/data-types/uuid.txt | 17 ----- 13 files changed, 287 deletions(-) delete mode 100644 examples/node/Examples/data-types.js delete mode 100644 source/examples/generated/node/data-types.codeblock.create-objects-with-mixed-values.js delete mode 100644 source/examples/generated/node/data-types.codeblock.define-mixed-in-schema.js delete mode 100644 source/examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.js delete mode 100644 source/sdk/node/data-types/collections.txt delete mode 100644 source/sdk/node/data-types/dictionaries.txt delete mode 100644 source/sdk/node/data-types/embedded-objects.txt delete mode 100644 source/sdk/node/data-types/field-types.txt delete mode 100644 source/sdk/node/data-types/mixed.txt delete mode 100644 source/sdk/node/data-types/sets.txt delete mode 100644 source/sdk/node/data-types/uuid.txt diff --git a/examples/node/Examples/data-types.js b/examples/node/Examples/data-types.js deleted file mode 100644 index ab3803d9a7..0000000000 --- a/examples/node/Examples/data-types.js +++ /dev/null @@ -1,63 +0,0 @@ -import Realm from "realm"; - -describe("Node.js Data Types", () => { - test("should work with Mixed Type", async () => { - // :code-block-start: define-mixed-in-schema - const DogSchema = { - name: "Dog", - properties: { - name: "string", - birthDate: "mixed", - }, - }; - // :code-block-end: - - const realm = await Realm.open({ - schema: [DogSchema], - }); - - // :code-block-start: create-objects-with-mixed-values - realm.write(() => { - // create a Dog with a birthDate value of type string - realm.create("Dog", { name: "Euler", birthDate: "December 25th, 2017" }); - - // create a Dog with a birthDate value of type date - realm.create("Dog", { - name: "Blaise", - birthDate: new Date("August 17, 2020"), - }); - // create a Dog with a birthDate value of type int - realm.create("Dog", { - name: "Euclid", - birthDate: 10152021, - }); - // create a Dog with a birthDate value of type null - realm.create("Dog", { - name: "Pythagoras", - birthDate: null, - }); - }); - // :code-block-end: - - // :code-block-start: query-objects-with-mixed-values - // To query for Blaise's birthDate, filter for his name to retrieve the realm object. - // Use dot notation to access the birthDate property. - let blaiseBirthDate = realm.objects("Dog").filtered(`name = 'Blaise'`)[0] - .birthDate; - console.log(`Blaise's birth date is ${blaiseBirthDate}`); - // :code-block-end: - expect(blaiseBirthDate).toEqual(new Date("August 17, 2020")); - - // delete the objects specifically created in this test to keep tests idempotent - const Euler = realm.objects("Dog").filtered(`name = 'Euler'`)[0]; - const Blaise = realm.objects("Dog").filtered(`name = 'Blaise'`)[0]; - const Euclid = realm.objects("Dog").filtered(`name = 'Euclid'`)[0]; - const Pythagoras = realm.objects("Dog").filtered(`name = 'Pythagoras'`)[0]; - realm.write(() => { - realm.delete(Euler); - realm.delete(Blaise); - realm.delete(Euclid); - realm.delete(Pythagoras); - }); - }); -}); diff --git a/source/examples/generated/node/data-types.codeblock.create-objects-with-mixed-values.js b/source/examples/generated/node/data-types.codeblock.create-objects-with-mixed-values.js deleted file mode 100644 index ab8b0517f0..0000000000 --- a/source/examples/generated/node/data-types.codeblock.create-objects-with-mixed-values.js +++ /dev/null @@ -1,20 +0,0 @@ -realm.write(() => { - // create a Dog with a birthDate value of type string - realm.create("Dog", { name: "Euler", birthDate: "December 25th, 2017" }); - - // create a Dog with a birthDate value of type date - realm.create("Dog", { - name: "Blaise", - birthDate: new Date("August 17, 2020"), - }); - // create a Dog with a birthDate value of type int - realm.create("Dog", { - name: "Euclid", - birthDate: 10152021, - }); - // create a Dog with a birthDate value of type null - realm.create("Dog", { - name: "Pythagoras", - birthDate: null, - }); -}); diff --git a/source/examples/generated/node/data-types.codeblock.define-mixed-in-schema.js b/source/examples/generated/node/data-types.codeblock.define-mixed-in-schema.js deleted file mode 100644 index 50f8ee7229..0000000000 --- a/source/examples/generated/node/data-types.codeblock.define-mixed-in-schema.js +++ /dev/null @@ -1,7 +0,0 @@ -const DogSchema = { - name: "Dog", - properties: { - name: "string", - birthDate: "mixed", - }, -}; diff --git a/source/examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.js b/source/examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.js deleted file mode 100644 index cd3ea34e2f..0000000000 --- a/source/examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.js +++ /dev/null @@ -1,4 +0,0 @@ -// To query for Blaise's birthDate, filter for his name to retrieve the realm object. -// Use dot notation to access the birthDate property. -let blaiseBirthDate = realm.objects("Dog").filtered(`name = 'Blaise'`)[0].birthDate; -console.log(`Blaise's birth date is ${blaiseBirthDate}`); diff --git a/source/sdk/node.txt b/source/sdk/node.txt index c205fa7d31..71100930c5 100644 --- a/source/sdk/node.txt +++ b/source/sdk/node.txt @@ -12,7 +12,6 @@ MongoDB Realm Node.js SDK Quick Start Quick Start with Sync Fundamentals - Data Types Usage Examples Integration Guides Advanced Guides diff --git a/source/sdk/node/data-types.txt b/source/sdk/node/data-types.txt index af7774d7af..983cc3d950 100644 --- a/source/sdk/node/data-types.txt +++ b/source/sdk/node/data-types.txt @@ -1,32 +1,3 @@ -.. _node-data-types: - ============================== Realm Data Types - Node.js SDK ============================== -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - -.. toctree:: - :titlesonly: - :hidden: - - Field Types - Collections - Dictionaries - Sets - Mixed - UUID - Embedded Objects - -- :doc:`Field Types ` -- :doc:`Collections ` -- :doc:`Dictionaries ` -- :doc:`Sets ` -- :doc:`Mixed ` -- :doc:`UUID ` -- :doc:`Embedded Objects ` \ No newline at end of file diff --git a/source/sdk/node/data-types/collections.txt b/source/sdk/node/data-types/collections.txt deleted file mode 100644 index f0675fafbd..0000000000 --- a/source/sdk/node/data-types/collections.txt +++ /dev/null @@ -1,16 +0,0 @@ -.. _node-data-types-collections: - -========================= -Collections - Node.js SDK -========================= - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - -Overview --------- diff --git a/source/sdk/node/data-types/dictionaries.txt b/source/sdk/node/data-types/dictionaries.txt deleted file mode 100644 index b0dc026ce2..0000000000 --- a/source/sdk/node/data-types/dictionaries.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. _node-data-types-dictionaries: - -========================== -Dictionaries - Node.js SDK -========================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - -.. versionadded:: 10.5.0-beta.1 - -Overview --------- \ No newline at end of file diff --git a/source/sdk/node/data-types/embedded-objects.txt b/source/sdk/node/data-types/embedded-objects.txt deleted file mode 100644 index c1ff8fd4cb..0000000000 --- a/source/sdk/node/data-types/embedded-objects.txt +++ /dev/null @@ -1,13 +0,0 @@ -.. _node-data-types-embedded-objects: - -============================== -Embedded Objects - Node.js SDK -============================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol diff --git a/source/sdk/node/data-types/field-types.txt b/source/sdk/node/data-types/field-types.txt deleted file mode 100644 index f9b36305cc..0000000000 --- a/source/sdk/node/data-types/field-types.txt +++ /dev/null @@ -1,16 +0,0 @@ -.. _node-data-types-field-types: - -========================= -Field Types - Node.js SDK -========================= - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - - -{+client-database+} supports the following field data types: diff --git a/source/sdk/node/data-types/mixed.txt b/source/sdk/node/data-types/mixed.txt deleted file mode 100644 index 4b3e280228..0000000000 --- a/source/sdk/node/data-types/mixed.txt +++ /dev/null @@ -1,65 +0,0 @@ -.. _node-data-types-mixed: - -=================== -Mixed - Node.js SDK -=================== -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - -.. versionadded:: 10.5.0-beta.1 - -Overview --------- -The mixed data type is a {+realm+} property type that can hold different data types. -Supported data types include: - -- bool -- int -- float -- double -- string -- Date -- Data -- UUID -- Set -- null - -.. note:: - - The mixed data type is indexable, but you can't use it as a primary key. - Because null is a permitted value, you can't declare a Mixed property as - optional. - -Realm Object Models -------------------- -To :ref:`set a property of your object model -` as mixed, set the property's type to -``"mixed"``. - -.. literalinclude:: /examples/generated/node/data-types.codeblock.define-mixed-in-schema.js - :language: javascript - -Create an Object With a Mixed Value ------------------------------------ -Create an object with a mixed value by running the :js-sdk:`realm.create() -` method within a write transaction. - -.. literalinclude:: /examples/generated/node/data-types.codeblock.create-objects-with-mixed-values.js - :language: javascript - -Query for Objects with a Mixed Value ------------------------------------- -Query for objects with a mixed value by running the -:js-sdk:`Collection.filtered() ` method and -passing in a :ref:`filter ` for a non-mixed field. You can -then print the value of the mixed property or the entire object itself. - -.. literalinclude:: /examples/generated/node/data-types.codeblock.query-objects-with-mixed-values.js - :language: javascript - - diff --git a/source/sdk/node/data-types/sets.txt b/source/sdk/node/data-types/sets.txt deleted file mode 100644 index 5dc7b5b845..0000000000 --- a/source/sdk/node/data-types/sets.txt +++ /dev/null @@ -1,18 +0,0 @@ -.. _node-data-types-sets: - -================== -Sets - Node.js SDK -================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - -.. versionadded:: 10.5.0-beta.1 - -Overview --------- \ No newline at end of file diff --git a/source/sdk/node/data-types/uuid.txt b/source/sdk/node/data-types/uuid.txt deleted file mode 100644 index b0a3a597ab..0000000000 --- a/source/sdk/node/data-types/uuid.txt +++ /dev/null @@ -1,17 +0,0 @@ -.. _node-data-types-uuid: - -================== -UUID - Node.js SDK -================== -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 2 - :class: singlecol - -.. versionadded:: 10.5.0-beta.1 - -Overview --------- \ No newline at end of file