In couchdb, I need to present some data in the following format: an external container that refers to other documents inside the array.
I want these documents to be separated, because I need to manage conflicts on them individually.
{
"_id" : "1"'
"type" : "container",
"items" : [ "1", "2", "3"]
}
{
"_id" : "2",
"value": "a"
"type" : "item"
}
{
"_id" : "3",
"value": "b"
"type" : "item"
}
{
"_id" : "4",
"value": "c"
"type" : "item"
}
I want to display the data representation in the following format.
{
"_id" : "1"'
"type" : "container",
"items" : [
{
"_id" : "2",
"value": "a"
"type" : "item"
},
{
"_id" : "3",
"value": "b"
"type" : "item"
},
{
"_id" : "4",
"value": "c"
"type" : "item"
}
]
}
What is the best way to approach this?
source
share