1

Sorry if this is a dump question but I cannot figure it out.

As collections grow in size, it become convenient to render a portion of the data. For that we can something like

model.query('items', { $skip: 30, $limit: 30 })

but what if we want to do that on a filter or a sort?   I have tried

model.query('items', { $skip: 30, $limit: 30 }, { creation_time: -1})

to mimic MongoDB .find().

I haven't find a way to do a fetch/query on filters. Of course I don't want to slice after .get() since that would be problematic on large collections. I tried to use a ref() on filter with no success. Does someone know a recipe on how to handle those situations?

Thanks in advance.

PS: I hope .fetch() hold a cursor and wait for .get() to retrieve data.

rprescott
  • 13
  • 3

1 Answers1

2
model.query('items', { $skip: 30, $limit: 30, $orderby: {creation_time: -1}})
Vladimir Makhaev
  • 1,104
  • 2
  • 10
  • 23