Question: I have Zebra LP2824 printer. It is working properly on Windows XP, but It is not working properly on Windows 7. On windows 7 it prints the Test page on printer properties, but it is not printing in my application. It seems, that it can't find the port, the printer is using. On the same application, but on Windows XP it is printing. I am connecting the printer with USB.  

Does anyone knows what seems to be the problem?  

Thanks for help in advance. :)

Answer: 
The one thing you will want to make sure of here is that you have a sort on the query you wish to use to garnish your records. If no sort is used it will actually use find order, which is not `$natural` order.

Find order can differ between queries so if you run the query twice within the period of 2 minutes you might find that they don't return the same order. It does seem however that your query would be logically sorted on `tiem_difference`.

It should also by noted that this is not possible through normal querying. I also do not see an easy way doing this through the aggregation framework.

So already it seems the next plausible method is either using multiple queries or client side processing. Client side processing is probably the better here using a function like the one defined by @Marlon above.
Assuming those 3 objects are coming through in an array, you could do something like the below:

```
var prevTime;
var currentTime;

for(var i = 0; i < records.length; i++)
{
    currentTime = new Date(records[i].time).getTime();
    records[i].time_difference = currentTime - prevTime;
    prevTime = currentTime;
}

```

Of course you'll need to swap bits out to make it use the records from mongo.

If you need to do any more complex date calculations, I highly suggest checking out [datejs](http://www.datejs.com/) (which you can get a node wrapper for if you want).