有这样一个结构的document:
"newsid" : 1,
"title" : "上海天气",
"token" : [
{
"word" : "上海",
"weight" : 2
},
{
"word" : "天气",
"weight" : 4
}
]
很希望能够把相关的weight取出来,比如查询"天气",能返回4.
很不幸,做不到。下面是10Gen的解释:
Until version 2.1 it is not possible to only return the subdocument
elements (unless I've been away from the user group for too long and things
have changed).
Unfortunately currently you either must do this via an MR or manually
extract the subdocuments on client side.