You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Anthony Ananich <an...@inpun.com> on 2013/02/04 15:50:15 UTC
Update Handler: unique property
Hi!
I have a database of documents like that:
{
"_id" : "37686beb8d65e74665af55e69801a62c",
"ip" : "192.168.1.1",
"mac" : "01:23:45:67:89:ab"
}
And I have a design doc with update handler. How can I check if a new
document have an unique mac address? Is it possible in CouchDB? If no,
than do any walkarounds exist?
Thanks!
Anthony
Re: Update Handler: unique property
Posted by Robert Newson <rn...@apache.org>.
Only the _id is unique, so you could put the MAC address in your _id
or as your _id.
B.
On 4 February 2013 14:50, Anthony Ananich <an...@inpun.com> wrote:
> Hi!
>
> I have a database of documents like that:
> {
> "_id" : "37686beb8d65e74665af55e69801a62c",
> "ip" : "192.168.1.1",
> "mac" : "01:23:45:67:89:ab"
> }
> And I have a design doc with update handler. How can I check if a new
> document have an unique mac address? Is it possible in CouchDB? If no,
> than do any walkarounds exist?
>
> Thanks!
> Anthony
Re: Update Handler: unique property
Posted by Johannes Jörg Schmidt <sc...@netzmerk.com>.
Uniqueness can only be enforced for _id. Use the MAC address as _id.
g jo
2013/2/4 Anthony Ananich <an...@inpun.com>
> Hi!
>
> I have a database of documents like that:
> {
> "_id" : "37686beb8d65e74665af55e69801a62c",
> "ip" : "192.168.1.1",
> "mac" : "01:23:45:67:89:ab"
> }
> And I have a design doc with update handler. How can I check if a new
> document have an unique mac address? Is it possible in CouchDB? If no,
> than do any walkarounds exist?
>
> Thanks!
> Anthony
>