couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Stott <jonathan.st...@gmail.com>
Subject Re: Best Way to Handle Inserting HTML Data
Date Wed, 17 Nov 2010 01:35:56 GMT
I suggest not doing JSON (de)serialization on your own.

Make your script do all the denormalization, and convert the result to
a hash/dictionary.  Almost all languages have a JSON encoder that will
do the correct escaping for you. POST it to couch DB.  On the way out,
JSON decode the result, which will unescape things appropriately, and
give you back a dictionary/hash.

Regards
Jon

On 17 November 2010 01:27, Matthew Woodward <matt@mattwoodward.com> wrote:
> On Tue, Nov 16, 2010 at 5:07 PM, Mike Miller <mike@cloudant.com> wrote:
>
>> Can you just save the HTML as an attachment?  -Mike
>
>
> Well ... I thought about that too. Here's the issue.
>
> Basically the database is of an event with some high-level details (name of
> event, date/time, location, etc.), and an array of attendees. The attendee
> JSON object has name, title, etc. and then an attendee statement, which is
> where the HTML comes in since these statements can be either hyperlinks or
> full-blown HTML documents right in the database.
>
> Right now I have the event as my document in my CouchDB database, and then I
> have an array of attendees. So if I have 10 attendees each with a statement,
> then if I do attachments I'd have to figure out how to map the statement
> back to the attendee within my attendee array. So I considered doing
> attachments but couldn't figure out how to handle knowing which attachment
> went with which attendee.
> --
> Matthew Woodward
> matt@mattwoodward.com
> http://blog.mattwoodward.com
> identi.ca / Twitter: @mpwoodward
>
> Please do not send me proprietary file formats such as Word, PowerPoint,
> etc. as attachments.
> http://www.gnu.org/philosophy/no-word-attachments.html
>

Mime
View raw message