Closed yi closed 10 years ago
Hi @yi,
I simply think it depends on how you are using the paginator.
Looks like your Ticket model sorts _id asc
and in your controller you add created_at desc
.
This makes the paginator to both sort on _id
and created_at
.
Have you turned on debug in mongoose to see the query sorting options?
Installed your project and in mongoose debug i found this,
Mongoose: tickets.find({}) {
fields: undefined,
paginateKey: '_id', limit: 10, sort: { _id: 1, created_at: -1 }
}
When you are sorting on created_at there is no reason to sort on created_at, because MongoDB _id
field contains unix_timestamp
Hi Jonas, I apologize for this issue. It's my fault. The sort sentence came from legacy code which I forgot to remove.
And I also found I made another mistake that I mixed before and after. Now it works correctly.
Many thanks and I close this ticket.
Hi Jonas,
I've found that might be a bug, or may be my misunderstanding.
Sorry, I haven't dive into your implementation code, because I'm currently working against a tough deadline :-(
[The problem] paginater always return results even before/after has reach the end
[Step to reproduce]
100% reproducable
Steps:
These "remove duplicate" is the following quick fix I wrote to solve this problem: https://github.com/yi/node-ticket-manager/blob/master/public_src/js/jquery.mongoose-endless-scroll.coffee#L113