couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From didier lafforgue <>
Subject sorted documents by their position
Date Thu, 06 Aug 2009 13:21:27 GMT
hi all,

I'm having fun time with couchdb but I'm stuck with a simple problem:
documents sorted by their position. Actually, I've documents called projects
described like this:

  _id: "first_project",
   name: "my first project",
   description: "lorem ipsum ...",
   type: "project"

  _id: "second_project",
   name: "my second project",
   description: "lorem ipsum ...",
   type: "project"

And I'd like to sort them using a drag&drop ui. So, I thought about adding a
new field (named position) and then updating their position field once I
dragged one of them. You get the picture.
Unfortunately, partial updates do not seem to exist in couchdb and I do not
like the fact to save ALL my documents to update their positions, especially
when I have hundred or thousand of projects.
I came with an idea: denormalize the position field and create a document
storing the positions (just an array field with project ids) so that I do
not have to update all my documents but just the positions document. My only
concern is that I'm unable to sort my projects with a couchdb view (I've to
do it in the server side which is dirty).

Is there a clean way to solve my problem ?
Thanks guys !


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message