From user-return-23915-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Fri Mar 15 02:13:44 2013 Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6774BDBD8 for ; Fri, 15 Mar 2013 02:13:44 +0000 (UTC) Received: (qmail 63683 invoked by uid 500); 15 Mar 2013 02:13:42 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 63647 invoked by uid 500); 15 Mar 2013 02:13:42 -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 63639 invoked by uid 99); 15 Mar 2013 02:13:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 02:13:42 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [128.18.84.132] (HELO brightmail-internal3.sri.com) (128.18.84.132) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 02:13:34 +0000 X-AuditID: 80125484-b7f1a6d0000064e9-c4-514283b75e37 Received: from exchange-hub01.SRI.COM (exchange-hub01.SRI.COM [128.18.23.153]) (using TLS with cipher AES128-SHA (AES128-SHA/128 bits)) (Client did not present a certificate) by brightmail-internal3.sri.com (SRI Internal SMTP Gateway) with SMTP id E3.14.25833.7B382415; Thu, 14 Mar 2013 19:13:11 -0700 (PDT) Received: from EXCHANGE-DB08.SRI.COM ([fe80::a11e:7c21:6886:9a20]) by exchange-hub01.SRI.COM ([2002:8012:1799::8012:1799]) with mapi id 14.02.0298.004; Thu, 14 Mar 2013 19:13:08 -0700 From: Jim Klo To: "" Subject: Re: Tracking doc access Thread-Topic: Tracking doc access Thread-Index: AQHOIRgA4u0eQdz1X0yL+QTm+J7jL5imeHAA Date: Fri, 15 Mar 2013 02:13:07 +0000 Message-ID: References: <514271C0.3080806@bardubitzki.com> In-Reply-To: <514271C0.3080806@bardubitzki.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [192.12.16.226] Content-Type: multipart/signed; boundary="Apple-Mail=_E6F61B60-9104-4358-B904-93BE2009B749"; protocol="application/pkcs7-signature"; micalg=sha1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsXSICQ+U3d7s1OgweT5Ohade/ayOTB6bPxw nDGAMYrLJiU1J7MstUjfLoEr4/DngywF/1Mrdj97ydjA+Cmmi5GDQ0LAROLwSY0uRk4gU0zi wr31bF2MXBxCAjuZJLqnPGOGcHYzSjyZdI4ZpIpNQF7i8PYHYLaIgKXErQUfWUBsYQEFiU97 H7BAxBUllu/4wAZhG0l8mtbGDmKzCKhKXJx9hxXE5hWwkvi1aT8jiC0koCfx7+JpsJmcAvoS a44uZwKxGYEu+n5qDZjNLCAucevJfCaIS0UkHl48zQZhi0q8fPyPFcJWlFjX9Jcdon4Ko8Sc q0IQuwQlTs58wjKBUWQWklGzkJTNQlIGEU+S+Hl2DiuErS2xbOFrZgjbQOJp5yss4voSb97N gZppKvH66EdGCNtaYsavg2wQtqLElO6H7AsYuVcxyiQVZaZnlOQmZubowqLTWK+4KFMvOT93 EyM4YkNadjCu2GV4iFGAg1GJh9fytEqAEGtiWXFl7iFGCQ5mJRHeXX8dA4V4UxIrq1KL8uOL SnNSiw8xSnOwKInzhhnz+wsJpCeWpGanphakFsFkmTg4pRoY+64sbqiZue0o06c0H6+ql3PT L8/r+tF9fv9mI8sj9cvnrnQW5Z9l+MvzlrUq87PH5h4fT2Z6nflueujIhoafrGsvBPB5HnRN btA4E3xNY8+Cy5e4mvdf2+BlEbVxj+n6oBm/34qFr/GsO5XzTts+x7JuXUBDwTXDRX2Gwpts jrb4v7VJvXbXT4mlOCPRUIu5qDgRAOSi+TfUAgAA X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_E6F61B60-9104-4358-B904-93BE2009B749 Content-Type: multipart/alternative; boundary="Apple-Mail=_713F78C2-6DA4-42BE-A9DC-B8904D5F1291" --Apple-Mail=_713F78C2-6DA4-42BE-A9DC-B8904D5F1291 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 I think you'd be better off tracking access by inserting an immutable = document with a new timestamp and doc._id of the accessed document. You could then create a view that 'joined' the timestamp doc with real = doc, by emiting timestamp as key and { _id: accessed_doc._id } as the = value then requesting with_docs=3Dtrue if I remember correctly=85=20 Updating doc to append a timestamp would be inherently slow if you have = a high volume of repeat access and cause your views to consistently have = to update=85 just my 2=A2 - Jim Jim Klo Senior Software Engineer Center for Software Engineering SRI International t. @nsomnac On Mar 14, 2013, at 5:56 PM, Stephan Bardubitzki = wrote: > Hi there, >=20 > I have a task where I need to track how often a doc is accessed. The = two possible ways I can think of are: >=20 > 1. add an array to the doc and add the timestamp when it is accessed > 2. create a new document and add the doc._id and the timestamp >=20 > Which one would you prefer? Or is there a better solution? >=20 > Thanks, > Stephan >=20 --Apple-Mail=_713F78C2-6DA4-42BE-A9DC-B8904D5F1291 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 I = think you'd be better off tracking access by inserting an immutable = document with a new timestamp and doc._id of the accessed = document.

You could then create a view that 'joined' = the timestamp doc with real doc, by emiting timestamp as key and { _id: = accessed_doc._id } as the value then requesting with_docs=3Dtrue if I = remember correctly=85 

Updating doc to = append a timestamp would be inherently slow if you have a high volume of = repeat access and cause your views to consistently have to = update=85

just my 2=A2

-= Jim

Jim Klo
Senior Software Engineer
Center for Software Engineering
SRI = International
t. = @nsomnac

On Mar 14, 2013, at 5:56 PM, Stephan Bardubitzki <stephan@bardubitzki.com>
 wrote:

Hi = there,

I have a task where I need to track how often a doc is = accessed. The two possible ways I can think of are:

1. add an = array to the doc and add the timestamp when it is accessed
2. create = a new document and add the doc._id and the timestamp

Which one = would you prefer? Or is there a better = solution?

Thanks,
Stephan


= --Apple-Mail=_713F78C2-6DA4-42BE-A9DC-B8904D5F1291-- --Apple-Mail=_E6F61B60-9104-4358-B904-93BE2009B749 Content-Disposition: attachment; filename="smime.p7s" Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJ/zCCBO0w ggRWoAMCAQICEDJaYyWeLlo372z82sws71YwDQYJKoZIhvcNAQEFBQAwgdgxCzAJBgNVBAYTAlVT MRowGAYDVQQKExFTUkkgSW50ZXJuYXRpb25hbDEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0 d29yazE7MDkGA1UECxMyVGVybXMgb2YgdXNlIGF0IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9y cGEgKGMpMDIxMDAuBgNVBAsTJ0NsYXNzIDIgT25TaXRlIEluZGl2aWR1YWwgU3Vic2NyaWJlciBD QTEdMBsGA1UEAxMUU1JJIEludGVybmF0aW9uYWwgQ0EwHhcNMTIxMjIyMDAwMDAwWhcNMTMwNjIw MjM1OTU5WjCBwjEaMBgGA1UEChQRU1JJIEludGVybmF0aW9uYWwxKDAmBgNVBAsUH0luZm9ybWF0 aW9uIFRlY2hub2xvZ3kgU2VydmljZXMxRjBEBgNVBAsTPXd3dy52ZXJpc2lnbi5jb20vcmVwb3Np dG9yeS9DUFMgSW5jb3JwLiBieSBSZWYuLExJQUIuTFREKGMpOTkxEjAQBgNVBAMTCUphbWVzIEts bzEeMBwGCSqGSIb3DQEJARYPamltLmtsb0BzcmkuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A MIIBCgKCAQEArcAb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