1

Given this document:

{
"Country": {
"ISO-3166-1-Alpha-2":  "AD" ,
"ISO-3166-1-Alpha-3":  "AND" ,
"ISO-3166-1-Numeric": 20 ,
"ISO-3166-2":  "ISO 3166-2:AD" ,
"LongNames": {
"en-us":  "Andorra"
} ,
"ShortNames": {
"en-us":  "Andorra"
} ,
"WebName":  "Andorra"
} ,
"id":  "AD"
}

What would the right query to return just WebName ?

I've tried using Map(), but the results aren't what I expect:

r.db("main").table("countries").limit(1).map(function(r) { return r.WebName; });

RqlDriverError: Anonymous function returned `undefined`. Did you forget a `return`?
4

1 回答 1

2

在 JavaScript 中,(...)是字段选择器。

r.db("main").table("countries").limit(1)('Country')('WebName')
于 2015-02-05T19:14:42.573 回答