couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Coallier <david.coall...@gmail.com>
Subject Re: Time processing difference between 0.11.0b898401 and 0.11.0b903617
Date Thu, 28 Jan 2010 01:37:41 GMT
>
> 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

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

Mime
View raw message