couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: underscores in json keys
Date Wed, 26 Aug 2009 22:16:10 GMT
On Wed, Aug 26, 2009 at 6:03 PM, francisco
treacy<> wrote:
> Oh, ok.
> This means the cornerstone of my library is built upon a bug :)

I wouldn't say that. There's nothing that keeps your library from
reserving a prefix for its internal use. You're free to use anything
like $ or # or even use a _ suffix.

> Is there any way I can define such a key, in order to interfere as
> less as possible with library user's data? (i was thinking perhaps
> externals some way to define some "reserved" keys?)

The only two approaches would be convention and nesting. If you want
to make sure you can store anything at all with the library, the only
real answer is to create an object like {"_id": "foo", "user_data":
...} but just using another non-underscore prefix wouldn't be too far
out of the question. Granted you might want to see if anyone else has
nominated one for consistency across libraries.

Paul Davis

View raw message