Re: [nodejs] node-mongodb-native problems with sort

2012-07-16 Thread john.tiger
well, after cloning the latest github version now the Bson module can't be found (we use the libs directly not using npm - even putting the bson folder under mongodb folder does not work - are there now hard coded paths ? On 07/16/2012 12:35 AM, christkv wrote: sort seems to work fine. the

Re: [nodejs] node-mongodb-native problems with sort

2012-07-15 Thread christkv
sort seems to work fine. the following code works both under the current 1.0.2 and next 1.1 release /** * @ignore */ exports.shouldCorrectlySortDates = function (test) { var collection = client.collection('shouldCorrectlySortDates'); var numberOfInserts = 5; var id = setInterval(function

Re: [nodejs] node-mongodb-native problems with sort

2012-07-15 Thread john.tiger
On 07/15/2012 07:41 AM, Daniel Rinehart wrote: One thing to try would be to startup mongosniff and see what command the driver is sending to Mongo. http://www.mongodb.org/display/DOCS/mongosniff thks but running out of time to spend on this - now looking at work arounds -- Daniel R. [http

Re: [nodejs] node-mongodb-native problems with sort

2012-07-15 Thread Daniel Rinehart
One thing to try would be to startup mongosniff and see what command the driver is sending to Mongo. http://www.mongodb.org/display/DOCS/mongosniff -- Daniel R. [http://danielr.neophi.com/] On Sat, Jul 14, 2012 at 8:41 PM, john.tiger wrote: > this driver is not sorting this correctly - or may

Re: [nodejs] node-mongodb-native problems with sort

2012-07-14 Thread john.tiger
this driver is not sorting this correctly - or maybe the sort just doesn't work with toArray - I can get the desired sort to work directly from the Mongo command line. I'll try the sort with cursor and then loop thru and push to an array to see if that works any better. On 07/14/2012 05:11

Re: [nodejs] node-mongodb-native problems with sort

2012-07-14 Thread Dan Milon
Actually first parameter is query, second is fields to fetch (optional, and 3rd is options. For sorting you can either do: coll.find({ username: username }, { sort: { date: -1 } }) or coll.find({ username: username }).sort({ date: -1 }) and variants with arrays, but havent tested any of this. D

Re: [nodejs] node-mongodb-native problems with sort

2012-07-13 Thread john.tiger
no, this does not work either. we had tried arrays because that was in the tests. also why would sort be outside of options object ?we are outputting the find to an array find().toArray(function(err,docs){ - not sure if that affects it On 07/13/2012 02:20 PM, Jeremy Darling wrote:

Re: [nodejs] node-mongodb-native problems with sort

2012-07-13 Thread Jeremy Darling
try: col.find({username:**username}, {}, {sort: {date: -1}}, function(err, records){ console.log(records); }); 1st param is the query, 2nd param is options object, sort is an object under the options object as entered in the Mongo CLI. In your examples your using arrays instead of objects. -

[nodejs] node-mongodb-native problems with sort

2012-07-13 Thread john.tiger
have tried various syntax but nothing seems to be working - and which is right docs vs examples vs tests (I would think tests - some show "desc" some show "-1" here's an example: coll.find({"username":username}, {"sort":['date','desc']}, function(err,cursor) { also tried as per test: coll.f