Thursday, 16 March 2017

Realm-js and Node Js: application freezes

I'm testing realm-js using Node JS and WebStorm. I created a little program:

'use strict';
 var Realm = require('realm');

 var realm = new Realm({
     schema: [{name: 'Dog', properties: {name: 'string', age: 'int'}}]
 });

 realm.write(() => {
     realm.create('Dog', {name: 'Rex', age: 3});
     realm.create('Dog', {name: 'Jack', age: 5});
 });

 var dogs = realm.objects('Dog');
 var anyDogs = dogs.filtered('age = 5');
 console.log(anyDogs);

During execution I received the following answer:

Results { '0': RealmObject { name: 'Jack', age: 5 } }

It seems ok, but after this application freezes and I can return to edit mode by pushing Stop button only. The same situation is occurred when I start application from console:

$ node app.js

Can anybody explain me where I made an error?



via Hermann

No comments:

Post a Comment