Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 65341 invoked from network); 1 Apr 2010 18:52:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Apr 2010 18:52:24 -0000 Received: (qmail 51068 invoked by uid 500); 1 Apr 2010 18:52:22 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 51034 invoked by uid 500); 1 Apr 2010 18:52:22 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 51026 invoked by uid 99); 1 Apr 2010 18:52:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Apr 2010 18:52:22 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=AWL,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of faust451@gmail.com designates 209.85.220.220 as permitted sender) Received: from [209.85.220.220] (HELO mail-fx0-f220.google.com) (209.85.220.220) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Apr 2010 18:52:16 +0000 Received: by fxm20 with SMTP id 20so1318933fxm.32 for ; Thu, 01 Apr 2010 11:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type :content-transfer-encoding; bh=6Ujckwf3+ak2uis1DlJmZtG6mM+aQGpdfTB3o8jS5Hw=; b=hthV9Fzrd10OqRnSbppjeIvsuMXR6hiHcSbv6eWXgoGzMviQSiWYfk+BA6Sdsx2AHR YCP8nA5t30L1GteSj6+RwD39tCt9ZEqGZFobFjQpfAX8k2tahem/vntNF4/9JMp1do0e Zwh2jEla03B2NiiQxiRghWUViYmzMLW0x0PCw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=dKocA4+4Shf6kETisG8zdTcWhs0ME0i2FyUKrThxe/f2qIzNnmZRta5g7py94X9nFk Qm6s+Ry12y5j0ownmcCCpMZPBVn68028vShiC422uUJhqTqui1s8e1WVb/MDWcl/ldaP +/o0PlXvZ35yrhwcBwEnuAQA9OxOF/Gfr5q/0= MIME-Version: 1.0 Received: by 10.86.51.16 with HTTP; Thu, 1 Apr 2010 11:51:54 -0700 (PDT) In-Reply-To: <6878DAF8-B582-4D83-AD33-2F590CB27313@apache.org> References: <91076E76-9FAB-4590-82E2-9B14563882F0@gmail.com> <6878DAF8-B582-4D83-AD33-2F590CB27313@apache.org> Date: Thu, 1 Apr 2010 22:51:54 +0400 Received: by 10.86.119.19 with SMTP id r19mr2479008fgc.76.1270147914955; Thu, 01 Apr 2010 11:51:54 -0700 (PDT) Message-ID: Subject: Re: Validate uniqueness field From: faust 1111 To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable But in bulk updates its impossible to track uniqueness. only when i update single doc i can before save delete old uniq_doc(with _id =3D uniq_field_value) and create new. 2010/3/28 Jan Lehnardt : > The only solution to enforce uniqueness on a field is using the _id field= of a document. If you need two fields to be unique in a database, you'll n= eed to use two documents for that. > > In addition, in the distributed case, the only way to ensure uniqueness i= s eventually, after replication, through conflicts that show up if two node= s created the same "unique" id. > > Cheers > Jan > -- > > On 27 Mar 2010, at 20:41, faust 1111 wrote: > >> Why too documents? >> But i have one issue User >> =A0i need only one document . >> >> i am interesting, how couch people do in real projects. >> when they need =A0two unique fields in document. >> >> >> 2010/3/28 Jan Lehnardt : >>> You need to have two documents with a unique ID each. >>> >>> Cheers >>> Jan >>> -- >>> >>> On 27 Mar 2010, at 17:12, faust 1111 wrote: >>> >>>> but what if i have two unique fields >>>> =A0login >>>> =A0email >>>> >>>> 2010/3/28 J Chris Anderson : >>>>> >>>>> On Mar 27, 2010, at 4:56 PM, faust 1111 wrote: >>>>> >>>>>> Hi >>>>>> >>>>>> In what way i cat implement validation of uniqueness? >>>>>> User >>>>>> =A0email: unique >>>>>> =A0login: =A0unique >>>>>> >>>>> >>>>> You can only have 1 unique field per database. you implement it by us= ing it as a docid, like >>>>> >>>>> { >>>>> "_id" : "user:unique", >>>>> =A0 ... >>>>> } >>>>> >>>>> Chris >>> >>> > >