You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Chris Stockton <ch...@gmail.com> on 2009/10/29 22:13:08 UTC

Reserved words

Hello,

I read "System reserved items start with underscore, ... does not
allow any user-defined property to begin with an underscore." at [1]
which left me curious if the _ rule applies to design doc names?
_design/_foo for example is valid as of .10.0, but is that going to
change?

We intend on possibly naming document properties "#_*" would this
cause future conflicts? Any recommendation for a "private" prefix for
property names within documents? Documents may contain properties that
belong to a user, so we are trying to avoid collisions (or is it best
to separate user named properties within a object in a named property:
i.e.: user_properties: {Field: "foo" ... Field10: "baz"}) ?

Regards,

-Chris

[1] http://wiki.apache.org/couchdb/Reserved_words

Re: Reserved words

Posted by Paul Davis <pa...@gmail.com>.
On Thu, Oct 29, 2009 at 5:13 PM, Chris Stockton
<ch...@gmail.com> wrote:

> _design/_foo for example is valid as of .10.0, but is that going to
> change?

Most interesting. The specific definitions we've used before are generally:

Underscore prefixes are reserved in the root of a document.
Underscore prefixes are reserved for document ids.

Seeing as the _foo is only internal to the document id, I'm not sure
if it should fall into the reserved scope or not. On the one hand, the
full docid is "_design/_foo" which is logically consistent, but "_foo"
is used internally in quite a few places. I can't think of an argument
for or against right now.

And as Andrew notes, if you're wanting to protect against user
property clashing then you should nest the user properties to avoid
spurious errors. Picking something like # or $ for an app's private
namespace should be fine otherwise.

Paul Davis

Re: Reserved words

Posted by Andrew Melo <an...@gmail.com>.
On Thu, Oct 29, 2009 at 4:13 PM, Chris Stockton
<ch...@gmail.com> wrote:
>
> We intend on possibly naming document properties "#_*" would this
> cause future conflicts? Any recommendation for a "private" prefix for
> property names within documents? Documents may contain properties that
> belong to a user, so we are trying to avoid collisions (or is it best
> to separate user named properties within a object in a named property:
> i.e.: user_properties: {Field: "foo" ... Field10: "baz"}) ?
>

On things that users can supply, I would suggest nesting that within
another element in your document, then you don't have to worry about
munging any names they supply.

Best,
Andrew


> Regards,
>
> -Chris
>
> [1] http://wiki.apache.org/couchdb/Reserved_words
>