0
你好,我是一个MongoDB的小白, ,我想检索后的评论列表:MongoDB的查询子列表
{
id:0,
ref:0,
type: 'image',
date: null,
title: 'this is my title',
comments:[
{
user : 'myUser',
text : 'text'
},
{
user : 'myUser2',
text : 'text2'
}
}
我怎么能只查询后的评论阵列?
我不想检索其中的评论,但只有评论没有别的?
这里是我与jongo第一次尝试:
Post.posts()找到( “{REF:#}”,REF)。.projection( “{评论:1}”)。如(帖子。 Commentaslass)
这不起作用:/,我想着将comments数组转换为Comment类型。 并使用投影只检索评论部分...