在架构中找不到对象类型xxx

编程入门 行业动态 更新时间:2024-10-26 02:30:07
本文介绍了在架构中找不到对象类型xxx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

首先,我首先定义了TestSchema,并创建了"let realm = new Realm({schema:[TestSchema]})",并且{realm.objects('Test').length}的结果正确. 当我尝试向领域中添加更多架构时,例如'let realm = new Realm({schema:[TestSchema,CarSchema,PersonSchema]})'',它显示了错误的味精. 在架构中找不到对象类型的汽车".我想知道这里发生了什么.

Firstly, i defined the TestSchema first, and create "let realm = new Realm({schema: [TestSchema]})",and the result for {realm.objects('Test').length} is right. When i try to add more schemas into realm, e.g.'let realm = new Realm({schema:[TestSchema, CarSchema, PersonSchema]})', it shows the wrong msg. "Object Type Car is not found in schema". I was wondering what's going on here.

推荐答案

将所有这些架构定义放在一个文件中,例如realm.js,并导出这些架构.

Put all these schema definitions in one file, say realm.js, and export these schemas.

您可以检查一下. github/realm/realm -js/blob/master/examples/ReactExample/components/realm.js

Hoho,我们可以在任何需要的地方调用领域db.

Hoho, we can call the realm db anywhere we want.

更多推荐

在架构中找不到对象类型xxx

本文发布于:2023-11-04 10:23:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557667.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中找   架构   对象   类型   xxx

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!