【问题标题】:Error: Object type 'Task' not found in schema错误:架构中未找到对象类型“任务”
【发布时间】:2021-08-16 02:01:19
【问题描述】:

我最近从 https://github.com/mongodb-university/realm-tutorial-react-native 克隆了 Realm React Native Tutorial 应用程序,并使用 https://www.youtube.com/watch?v=sDHNyDQOQvA 的同步指南,我在 getRealmApp.js 中配置了我的 appId,这基本上就是我所做的,没有任何自定义,至少现在还没有:)

但是,在模拟器上运行应用程序,注册工作正常,但是在添加新任务时,我收到错误:

错误:架构中未找到对象类型“任务”。

非常感谢您的帮助

【问题讨论】:

    标签: mongodb react-native realm realm-mobile-platform


    【解决方案1】:

    好吧,在彻底检查了文档之后,我不得不将架构添加到 Realm.open(config)

      const config = {
          schema: [Task.schema], //this line wasn't there
          sync: {
            user: user,
            partitionValue: projectPartition,
            newRealmFileBehavior: OpenRealmBehaviorConfiguration,
            existingRealmFileBehavior: OpenRealmBehaviorConfiguration,
          },
      };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-31
      • 1970-01-01
      • 2013-07-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多