Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BC89BE620 for ; Mon, 26 Nov 2012 20:10:59 +0000 (UTC) Received: (qmail 32687 invoked by uid 500); 26 Nov 2012 20:10:58 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 32608 invoked by uid 500); 26 Nov 2012 20:10:58 -0000 Mailing-List: contact dev-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 dev@couchdb.apache.org Received: (qmail 32507 invoked by uid 99); 26 Nov 2012 20:10:58 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Nov 2012 20:10:58 +0000 Date: Mon, 26 Nov 2012 20:10:58 +0000 (UTC) From: "jean honlet (JIRA)" To: dev@couchdb.apache.org Message-ID: <523964604.24385.1353960658697.JavaMail.jiratomcat@arcas> In-Reply-To: <1995939109.22921.1353941219818.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (COUCHDB-1612) Transform all documents at once MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COUCHDB-1612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13504049#comment-13504049 ] jean honlet commented on COUCHDB-1612: -------------------------------------- Great ! That fulfill my needs. Do you consider adding that functionnality into futon in the future? Thanks for this great product > Transform all documents at once > ------------------------------- > > Key: COUCHDB-1612 > URL: https://issues.apache.org/jira/browse/COUCHDB-1612 > Project: CouchDB > Issue Type: Wish > Components: Futon > Reporter: jean honlet > Priority: Minor > > Sometimes, I would like to modify all documents at once... > I use this function (jQuery, jquery.couchdb and Underscore necessary): > function actionAllTransform(transform, commit) { > // First get all documents: > jQuery.couch.db(dbname).allDocs({ > include_docs: true, > success: function(data) { > data = _.map(data.rows, function(v) { > return v.doc; > }); > // Remove the design documents > data = _.filter(data, function(doc) { return (doc._id.substring(0,8) != "_design/"); }); > // transform each document by a "transform" function > data = _.map(data, transform); > // If the function gave back null value, filter them out (they are considered as not modified) > data = _.filter(data, function(doc) { return (doc != null); }); > if (data.length == 0) { > // no record left, nothing to do... > return 0; > } > var bulk = { all_or_nothing: true, docs: data }; > // Check the result > console.log(bulk); > if (typeof(commit) == 'undefined') > return > // If commit, save the bulk in the db > if (commit) { > jQuery.couch.db(dbname).bulkSave(bulk, { > success: function() { > // youpee, it worked > } > }); > } > } > }); > }; > As far as I understand, the question is to be able to put that function in the futon interface... and render results in the same styleguide than the other panels. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira