Schema default values ignored when creating object



in my model I have properties that are mandatory but I would like to provide a default value. Realm node docs state that we can use the default attribute when creating the schema.
Here is model example :

        name: 'Scenario',
        primaryKey: 'uuid',
        properties: {
            uuid: 'string',
            name: 'string',
            imageUrl: { type: 'string', default: '' },
            description: 'string?'

When I try to create/insert an object by giving only the uuid and name :

realm.write(() => {
    var uuid = require('node-uuid');
    realm.create("Scenario", {uuid:uuid.v1(), name:"scenario1"});

I get this error : Error: Missing value for property ‘Scenario.imageUrl’.

Nullable values are not mandatory but values with defaults are ?
Am I understanding this wrong ?



@mbritto Are you setting up the schema properly? Everything you showed is fine. A thing that commonly trips people up with defaults in JS is that they aren’t persisted in the file, while everything else in the schema is.
So you can open an existing file without specifying the schema and everything but default values will work fine