Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "IsoFormattedDateAsDocId" page has been changed by DougShawhan. http://wiki.apache.org/couchdb/IsoFormattedDateAsDocId?action=diff&rev1=2&rev2=3 -------------------------------------------------- } }}} - Another advantage is using parseint() and datetime.substr() to cut out useful values for a return key: + Another advantage is using parseint() and datetime.substr() to cut out useful values for a return key: {{{#!javascript function (doc) { @@ -49, +49 @@ If you have python views enabled, you can use the datetime module in the same way: {{{#!python - def fun( doc ): + def fun(doc): from datetime import datetime - dt = datetime.strptime( doc._id, "%Y-%m-%dT%H:%M:%S.%f" ) + dt = datetime.strptime(doc._id, "%Y-%m-%dT%H:%M:%S.%f") - yield( [doc.host, dt.year, dt.month, dt.day, dt.hour, dt.minute ], 1 ) + yield [doc.host, dt.year, dt.month, dt.day, dt.hour, dt.minute], 1 }}} . . .example with reduce function as it appears in the design doc:
