From commits-return-6712-apmail-couchdb-commits-archive=couchdb.apache.org@couchdb.apache.org Sat Aug 6 19:22:17 2011 Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8A6806A72 for ; Sat, 6 Aug 2011 19:22:17 +0000 (UTC) Received: (qmail 93152 invoked by uid 500); 6 Aug 2011 19:22:17 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 93033 invoked by uid 500); 6 Aug 2011 19:22:16 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 93026 invoked by uid 500); 6 Aug 2011 19:22:15 -0000 Delivered-To: apmail-incubator-couchdb-commits@incubator.apache.org Received: (qmail 93023 invoked by uid 99); 6 Aug 2011 19:22:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Aug 2011 19:22:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.131] (HELO eos.apache.org) (140.211.11.131) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Aug 2011 19:22:12 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 027CE6B5; Sat, 6 Aug 2011 19:21:51 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Sat, 06 Aug 2011 19:21:50 -0000 Message-ID: <20110806192150.91365.70351@eos.apache.org> Subject: =?utf-8?q?=5BCouchdb_Wiki=5D_Update_of_=22SchemaForToDoList=22_by_JensAlf?= =?utf-8?q?ke?= Auto-Submitted: auto-generated X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for c= hange notification. The "SchemaForToDoList" page has been changed by JensAlfke: http://wiki.apache.org/couchdb/SchemaForToDoList New page: =3D Proposed Schema For To-Do Lists =3D Created by JensAlfke on 6 Aug 2011 =3D=3D Introduction =3D=3D The to-do list seems like a good use case for CouchDB: it's got a fairly we= ll-defined data format; queries are pretty straightforward; it's a very pop= ular type of application; and transparent syncing is a crucial feature. By defining a standard base data schema for applications to use, they can e= asily interoperate on a single data store, even if some apps add extra meta= data. =3D=3D=3D Applications =3D=3D=3D Some apps I looked at, and/or have used myself: * [[http://culturedcode.com/things/|Things]] * [[http://www.omnigroup.com/products/omnifocus|OmniFocus]] * [[http://www.rememberthemilk.com/help/guide/|RememberTheMilk]] * [[http://www.6wunderkinder.com/wunderlist|Wunderlist]] * [[https://www.producteev.com|Producteev]] =3D=3D Feature Set =3D=3D =3D=3D=3D Level 0: Required =3D=3D=3D The essential features of a to-do list are very simple. We need a set of it= ems with the following properties: * Title * Completed, aka Checked That's it, really. Couchbase's current mobile demo app has only these featu= res, and it's actually useful in the real world. = =3D=3D=3D Level 1: Common =3D=3D=3D When you look at real to-do list apps, they all have many of the following = extra features: * Star / Flag, or a range of priorities * Creation Date * Due Date (optional) * Notes * URL Link * Tags * Multiple named lists, where each item can be in one list at a time. * Hierarchies of lists * File attachments =3D=3D=3D Level 2: Advanced =3D=3D=3D Some extra features found in higher-end list apps: * Custom re-ordering of items in a list * Hierarchies of items * Recurring tasks that respawn on a schedule (weekly, first Tuesday of the= month, etc.) * Percent complete * Estimated time * Reminders at some interval before the due date I'm not going to address these here. Maybe in a future update to this spec. =3D=3D Document Schema =3D=3D =3D=3D=3D Item =3D=3D=3D * "type": "todo", required * "title": string, required * "check": boolean, defaults to false * "priority": boolean or number, defaults to false * "created_at": date-time* * "modified_at": date-time [not necessarily visible to the user, but usefu= l in conflict resolution] * "due_at": date or date-time * "notes": string * "link": string [a URL] * "category": string, defaults to "INBOX" [name of list this is in] * "tags": array * Dates and times are specified in ISO-8601 format, which appears to be the= de-facto standard used in JSON. A "date" doesn't contain the time portion = of the string. Times should all be given in GMT to allow for easy sorting v= ia collation. File attachments can be stored as, well, attachments. No need to define a s= pecific schema for them. =3D=3D=3D Category =3D=3D=3D For the most part the list of categories can be derived from the union of t= he "category" values of all "todo" items; but that implies that categories = with no items in them cease to exist, which isn't good! Defining an explici= t document type also leaves open the option of adding metadata to categorie= s in the future (e.g. colors or descriptions.) * "type": "category", required * "name": string, required * "parent": string It's not necessary for every category to have its own "category" document. = In other words, the application's UI should show a category for every uniqu= e "category" value that appears in a "todo" document, whether or not there'= s a "category" document for it. Otherwise a list item can disappear from th= e UI if its category document is renamed without updating its "category" va= lue, which can happen during replication. ''Question:'' Should we instead use a more normalized relation, where the t= odo item's "category" value is the _id of its category document? On the plu= s side, this allows renaming a category without having to update every item= in it. On the minus side, it could cause problems when merging. (For examp= le: on one device I add an item to a category, and on another device I dele= te that category. After syncing I'm left with an item pointing to a nonexis= tent category _id.)