简体   繁体   English

具有嵌套对象的Foxx模型架构

[英]Foxx model schema with nested objects

All the examples I've found for Foxx.Model schemas are flat - ie they don't include nested objects. 我发现的Foxx.Model模式的所有示例都是扁平的 - 即它们不包含嵌套对象。

I'm trying to add a hash to save geo info on a model like this: 我正在尝试添加哈希来保存模型上的地理信息,如下所示:

var Foo = Foxx.Model.extend({
    schema: {
      name: joi.string().required(),
      location: joi.object().keys({
        lat: joi.number(),
        lng: joi.number()
      })
    }
});

This shows up in the Foxx interface Data Type as this: 这显示在Foxx接口数据类型中,如下所示:

foo {
    name (string),
    location (object, optional)
}

How do I get it to show the key names 'lat' and 'lng' for the location object? 如何让它显示位置对象的键名'lat'和'lng'?

Or am I thinking about this incorrectly? 或者我错误地想到了这个?

You are using it correctly and it will work and check your object correctly. 您正确使用它,它将正常工作并检查您的对象。 This is just a limitation of the documentation tool used in the admin interface of ArangoDB. 这只是ArangoDB管理界面中使用的文档工具的限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM