Lucifer
Lucifer

Reputation: 516

select , distinct is not working in sailsjs

I was working in sailsjs a few day ago.

I just can't figure it out why my sailsjs app doesn't support select or distinct it says that this is not defind .

Am I missing something?

Please someone help me to figure this out.

I try this

Blog.find().select('keyfield').sort('createdAt DESC').done(function(err, selectedKeyfield) {
              res.view('home/index',{
              Keyfield: selectedKeyfield
        });

Thank you in advance....

Upvotes: 1

Views: 2919

Answers (1)

bredikhin
bredikhin

Reputation: 9035

If you are using the stable version of Sails, which is now something like 0.9.x, then .select() nor .distinct() haven't been introduced yet.

Here's the open requests for .distinct(): https://github.com/balderdashy/waterline/issues/60 https://github.com/balderdashy/sails-mongo/pull/55

Here's the issue about using projection with sorting, which will give you a hint on how to emulate .select(): https://github.com/balderdashy/sails-mongo/issues/53

Upvotes: 1

Related Questions