如何检查Realm数据库中是否存在Realm文件?还希望检查该模式在该特定领域中是否存在

时间:2019-05-10 10:11:29

标签: javascript reactjs react-native realm

实际上,我想在打开Realm之前应用检查,是否有任何方法可以检查Realm数据库中是否存在提供的路径 如果存在,还希望检查模式是否已经存在

考虑拥有名称为myrealm.realm的领域

var realm = Realm.open({ path:'myrealm.realm', schema:[ { name: 'Dog', 
   properties: {name : 'string'}} , { name: 'Person', properties: { name : 
   'string'}} ]}).then( (realmInstance) => {
    realmInstance.objects('Customer').isValid() // this must return false as 
    customer is not present but it shows exception 
  })

请提出验证模式的方法

0 个答案:

没有答案