[17:04:16] <b10011> Hi, I'm quite new to mongodb and I have this problem with sorting in populate -method. I have populated my query deep and now I want to sort, right, that was easy. But I want to sort with multiple fields. Still successful. But I want to make sure that the order of fields used in sorting is not random.
[17:05:50] <b10011> I know that for .sort() you can give [[fieldname: "<ascending/desceding>"], ...] but for populate options field I can only give { sort: { field1: "ascending", field2: "ascending" } } and nothing guarantees that field1 would be primary field for sorting and field2 secondary field.
[17:11:41] <Derick> no, field1 would definitely be the primary one
[17:11:52] <Derick> but instead of the names "ascending" and "Descirbing", you need to use 1 and -1
[17:12:30] <b10011> Are objects/dictionaries/maps in nodejs ordered?
[17:17:23] <b10011> Damn, those seem to be ordered (Object.keys() always returns them in the same order you defined them).