Vlad GURDIGA a écrit : > On Thu, Jul 9, 2009 at 9:46 PM, Thad Guidry<[email protected]> wrote: >> Morbus, >> >> I can think of one wiki article that helped me tremendously in understanding >> the CouchDB way of relationships. And how I could apply that to library >> cataloging techniques. >> >> http://wiki.apache.org/couchdb/EntityRelationship > > I apologize for the fact that I may be a little off-topic but reading > this article a question came up regarding the second model presented > in the "One to Many: Embedded Documents" section: > > { > "_id":"Scott", > "type":"contact", > "name":"My Friend Scott", > "phones":[{"home":"(650) 555 - 2200"},{"mobile":"(650) 555 - 2201"}], > } > > What is the pros and cons of having phones stored as an array of > associative hashes versus having them as an associative hash? Here is > what I mean: > > { > "_id":"Scott", > "type":"contact", > "name":"My Friend Scott", > "phones":{"home":"(650) 555 - 2200","mobile":"(650) 555 - 2201"} > } > > It seams to me more intuitive syntax.
But then it would be an object, not an array of objects, no? Since "phones" is a list, using a JSON array makes more sense, at least to me. Lunra.
