Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29599

Realm.objects() in react-native app return empty objects

$
0
0

I'm creating a db in realm, but when i want to consult the data with Realm.objects() return empty objects, like this: {"0":{},"1":{},"2":{}...etc}, my code is the next:

import Realm from "realm";
const nombreEsquema = 'Imagen12';
class Imagen {}

let esquema = Imagen.schema = {
   name: nombreEsquema,
   properties: {
      nombre: {
         type: 'string'
      },
      uri: {
         type: 'string'
      },
      url: {
         type: 'string'
      },
   }
};

let dbRealm = Realm.open({
   schema: [esquema]
});

functionRealm() {
   dbRealm.then(realm => {
      realm.write(() => {
         realm.create(nombreEsquema, {
            nombre: 'David',
            url: 'My URL',
            uri: 'My URI'
         });
      });

      let images = realm.objects(nombreEsquema);
      console.log("------------------------------");
      for (let i of images) {
         console.log(i);
      }
   });
}

i read the realm's documentation but i don't see anything with that problem, my realm version is 5.0.2, and i don't know what i'm doing bad, i hope you can help me with my problem.


Viewing all articles
Browse latest Browse all 29599

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>