GraphQL在嵌套对象内返回null属性

时间:2019-06-25 13:26:01

标签: mongodb graphql react-apollo apollo-server

我正在寻求解决类似graphql的查询

category {
root {
name
title
}
}

一个类别可能有也可能没有根,并且root是mongodb中的嵌入式对象,如果类别没有根,则存储为null。

但是,当根为null时,Graphql返回:

category: {
root: {
name: null,
title: null
}
}

而不是重新使用category: {root: null}

感谢您对此事的帮助。

0 个答案:

没有答案
相关问题