【发布时间】:2019-10-15 05:49:54
【问题描述】:
我有一个这样的 MongoDB mongoose 架构:
const playerSchema = Schema({
conditions: { type : Object },
date: String
})
这样的集合:
{
_id: 5cee935cb56d5f794b452d78,
conditions:
{
condition_a: [5.9, 6.0],
condition_b: [6.1, 4.9],
condition_c: [4.9, 4.0]
},
date: 'Wed May 29 2019 16:45:00 GMT+0200 (GMT+02:00)',
},
{
_id: 5cee935cb56d5f794b452d70,
conditions:
{
condition_a: [5.8, 6.1],
condition_c: [4.3, 3.0]
},
date: 'Wed May 29 2019 16:47:00 GMT+0200 (GMT+02:00)',
},
[...]
如何为此制作 GraphQL Schema? 我已经尝试过这样的事情
buildSchema(`
type Player {
_id: ID!
condition: Object
date: String
}
`)
也试过了:[[String]],{},{String} ... 没有运气
不能选择包含条件和与Player 关系的集合。
【问题讨论】:
标签: mongodb mongoose graphql express-graphql