On Wed, Jan 27, 2010 at 5:37 PM, David Coallier
<[email protected]> wrote:
>>
>> I just tested with my copy of trunk and this temp view:
>>
>> function(doc) {
>> var d = new Date("2010/02/04");
>> emit(d, null);
>> }
>>
>> I only have one doc, in there, so my rows are
>>
>> "2010-02-04T08:00:00.000Z", null
>>
>> Which to me looks like what I was expecting.
>>
>
> I have tried on a clean db with 1 document as well
> function(doc) {
> var d = new Date("2010/02/04");
> emit(d, null);
> }
>
> This emits
> {}, null
>
Hmm, something is up. Maybe you have a different SpiderMonkey version than me?
Mine:
$ js -v
JavaScript-C 1.8.0 pre-release 1 2007-10-03
> And from the log(d); I get
> Thu, 28 Jan 2010 01:28:38 GMT] [info] [<0.23547.0>] OS Process
> #Port<0.6750> Log :: {}
>
> I get the same with
> function(doc) {
> var d = new Date(1264515335 * 1000);
> emit(d, null);
> }
>
> ( http://skitch.com/davidcoallier/n1tmy )
>
> However, the interesting bits to note is that, even though this
> outputs {}, null I can still use the d (Date) object.
>
> function(doc) {
> var d = new Date(1264515335 * 1000);
> emit(d.getFullYear(), null);
> emit(d.getUTCMonth()+1, null);
> }
>
> I get:
>
> 2010, null
> 1, null
>
> Or (
> http://skitch.com/davidcoallier/n1tks/apache-couchdb-futon-browse-database
> )
>
>
>
>
>> That doesn't explain your {} though. Maybe it is the result of parsing
>> an invalidate date format? you can use log() in your functions to
>> output to the couch.log (at info level)
>>
>> Maybe you have an undefined that used to be silently ignored but now
>> is trying to serialize and coming out with {}?
>>
>
> The undefined is out of the equation considering that I check for date
> validity and field presence. However as you can see up there, this
> happens as well when I execute on a single document database as well.
>
>
>
> --
> Slan,
> David
>
--
Chris Anderson
http://jchrisa.net
http://couch.io