question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use projection?

See original GitHub issue

I want to use like this const projection = { items: { $slice: -5 } } ProjectModel.model.find({}, projection);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
TimGrellcommented, Apr 21, 2019

You should use options object

const options = {
    page: 1,
    limit: 10,
    projection: { items: { $slice: -5 } },
    sort: { _id: -1 }
};

Model.paginate({}, options);
1reaction
TimGrellcommented, Apr 21, 2019

You could do it like this:

const options = {
    page: 1,
    limit: 10,
    projection: { items: { $slice: -5 } },
    sort: { "items.price": -1 }
};

Model.paginate({}, options);
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set up a projector - CNET
9 tips to set up your projector perfectly · 1. Find the right location · 2. Set up the screen (optional) · 3....
Read more >
Turning On the Projector - Epson
Remove the projector's lens cover. · Connect the power cord to the projector's power inlet. · Plug the power cord into an electrical...
Read more >
How to Use a Projector as a TV - Lifewire
Set up the projector as you would normally. · Connect an HDMI cable to an input on your projector. · Connect the other...
Read more >
How Does Rear Projection Work? - Pro Display
The principles are pretty basic—you simply place your projector behind the screen, shooting towards the audience, set it to rear projection mode ...
Read more >
How to use Projection Calculator - Step-by-step Guide
Both throw distance and image size values can be locked. This is useful for example when you nailed down your screen size and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found