Hi!
We have a 3rd party client who expect values to be returned (after a GET
request) in this format:
*[*
* {*
"attributes": *{*
"intensity": *-12*,
"description": "Ground to cloud.",
"strike_time": "2017/04/17 02:14:32.000",
"age": *449*,
"latitude": *46.167*,
"longitude": *-66.81*
* }*
* }*,
* {*
"attributes": *{*
"intensity": *26*,
"description": "Cloud to ground.",
"strike_time": "2017/04/17 02:14:30.000",
"age": *449*,
"latitude": *46.035*,
"longitude": *-66.322*
* },*
*...*
]
However, the values that you would normally get from CouchDB, even with
views, would be something like:
{
"total_rows":2,
"offset":0,
rows: [
{
"id":"223345223355"
"key":'432523235"
"value":
{
"rev":"1-a34234234"
}
"doc":
{
"_id":"73234234"
"_rev":"2-a1324234"
"intensity": *-12*,
"description": "Ground to cloud.",
"strike_time": "2017/04/17 02:14:32.000",
"age": *449*,
"latitude": *46.167*,
"longitude": *-66.81*
* }*
},
{
"id":"123345223355"
"key":'132523235"
"value":
{
"rev":"1-234234234"
}
"doc":
{
"_id":"23234234"
"_rev":"1-a1324234"
"intensity": *26*,
"description": "Cloud to ground.",
"strike_time": "2017/04/17 02:14:30.000",
"age": *449*,
"latitude": *46.035*,
"longitude": *-66.322*
* }*
},
}
It does not matter that "attributes" was replaced with "doc" - that is
fine. The problem has more to do with the number of levels (it will now be
3 levels like xyz["rows"]["doc"]["intensity"] instead of the expected 2
levels like xyz["doc"]["intensity"]; and also the reply format (preferred
is list of objects but couchDB is giving just one object and the list is
just a member.
Is there a way to control the format of the returned value? I have seen
suggestion to use show function but have not seen enough example for this
particular use-case.
Thanks!
--
Noel P. Quintos