You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only the following types are supported: int, bool, float, double, string, data, date, objectId, uuid, decimal128 and links. Realm.create() will validate input accordingly.
Accessors
Due to the flexibility of JavaScript’s type system, we can return properties without much hassle.
varperson;realm.write(()=>{person=realm.create("Person",{stuff: 42,stuffList1: [42,"Everything"]});});person.stuffList1.forEach(item=>{console.log(typeof(item));// outputs two lines: 'number', 'string'});
When reading the scope, it seems to me that it won't be possible to store anything else than primitives in a property of Mixed type:
It should be possible to define a property of a class to be of Mixed type. This means that the property can hold values of all the primitive types (Int, Bool, Float, Double, String, Binary, Timestamp, ObjectId, UUID, Decimal128 and links). Lst must be supported too.
I suggest updating the description above to exclude the { name: "Arthur", harmless: "mostly" } example.
@kraenhansen I have removed it. According to the scope, links are supported, and we need to find a way to capture it. Using { name: "Arthur", harmless: "mostly" } was a clumsy example.
Introduction
For JavaScript developers, a mixed type is a natural concept due to JavaScript’s type system.
Schema
We can add a new type to the support by the object schema. The name
mixed
captures the concept "property of different kinds" well.Additional requirements for
mixed
properties:null
is always a permitted value.Creating objects with
mixed
Creating an object with a properties of mixed type should be natural for a JavaScript developer:
Only the following types are supported:
int
,bool
,float
,double
,string
,data
,date
,objectId
,uuid
,decimal128
and links.Realm.create()
will validate input accordingly.Accessors
Due to the flexibility of JavaScript’s type system, we can return properties without much hassle.
Moreover, updating a property is supported:
Serialization
It is important to support JSON serialization.
The text was updated successfully, but these errors were encountered: