问题描述
我刚开始使用 rethinkDB 查询语言,不明白如何选择第一个键(名称)。 在这种情况下,我将是对象注释。
我用 Object.keys(t)[0];尝试只返回我的参数,我做错了什么?
{
id: "mission@0",info:
"Tokyo",**//how to get the value of content ?**
note: {
"note@032b8836-f647-4165-9ec9-fc22769f3ffa": {
content: "hello world",context: "all",glyphId: "glyph@default",id: "note@032b8836-f647-4165-9ec9-fc22769f3ffa",Meta: {
context: null,createdAt: 1624044683953,links: null,parentEntity: "mission@0b1cd61d-bb36-4cf8-8f3d-9cc9b14ff054",references: { glyphId: "glyph" },rootAggregateId: "mission@0b1cd61d-bb36-4cf8-8f3d-9cc9b14ff054",rootAggregatePath: [
"private","notes","note@032b8836-f647-4165-9ec9-fc22769f3ffa",],status: "published",summaries: {
description: "hello world",glyph: "bookmark",glyphColor: "base",info: "hello world",},type: "note",values: null,version: 0,}
function* extract(next) {
const q = r
.db("test")
.table("mission")
.getAll(true,{ index: "recurrenceEnabled" })
.filter((mission) => mission("Meta")("status").eq("published"))
.map((m) => {
let t = m("private")("notes");
let p = Object.keys(t)[0];
return {
note: t,id: m("id"),info: m("Meta")("summaries")("info"),};
});
return yield q.run(con,next);
}
感谢您的阅读!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)