A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/model-data/data-types/mixed/ below:

Mixed - Node.js SDK - Atlas Device SDKs

Changed in version 12.9.0: Mixed properties can contain lists or dictionaries of mixed data.

New in version 10.5.0.

The mixed data type is a realm property type that can hold any valid Realm data type except an embedded object or a set. You can create collections (lists, sets, and dictionaries) of type mixed. Properties using the mixed data type can also hold null values.

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.

To set a property of your object model as mixed, set the property's type to "mixed".

const DogSchema = {  name: "Dog",  properties: {    name: "string",    birthDate: "mixed",  },};

Create an object with a mixed value by running the realm.create() method within a write transaction.

realm.write(() => {    realm.create("Dog", { name: "Euler", birthDate: "December 25th, 2017" });    realm.create("Dog", {    name: "Blaise",    birthDate: new Date("August 17, 2020"),  });    realm.create("Dog", {    name: "Euclid",    birthDate: 10152021,  });    realm.create("Dog", {    name: "Pythagoras",    birthDate: null,  });});

In SDK v12.9.0 and later, a mixed data type can hold collections (a list or dictionary, but not a set) of mixed elements. You can use mixed collections to model unstructured or variable data. For more information, refer to Define Unstructured Data.

To use mixed collections, define the mixed type property in your data model. Then, create the list or dictionary collection.

Query for objects with a mixed value by running the Collection.filtered() method and passing in a filter for a non-mixed field. You can then print the value of the mixed property or the entire object itself.

let blaiseBirthDate = realm.objects("Dog").filtered(`name = 'Blaise'`)[0]  .birthDate;console.log(`Blaise's birth date is ${blaiseBirthDate}`);

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4