couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trevor Green" <Tre...@MAILAGC.COM>
Subject How to view child arrays in couch
Date Thu, 16 Jun 2011 22:01:37 GMT
 

So what I want to do is store php objects in couch.

 

So 

 

Json_encode an object that may be a multi-dimensional array and store it
and the view it. 

 

The stored data would look something like this. 

 

{

                "url": "(a url)",

                "status": [{ "somename":

                                                {

"var1": "mystate",

                                                "var2":"mystate2"

}

}]

}

 

So how then do map this?

 

function(doc) {

                emit([doc.url, doc.status, doc.status.(use the first
nameas a key without explicity defining it (ex. somename) ) ], doc);

  }

}

 

Maybe use an if(doc.status.(first value) == "somename") to limit the
set?

 

How do you create views on lists like this that contain associative
arrays with arbitrary data? And how do you then access the children
(var1, var2). 

 

Can couch not handle a document like this that is valid json but isn't
flat? 

 

Or can it handle it and I have to somehow nest views to map the sub
arrays?

 

Thanks for any help.

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message