Rahul
Rahul

Reputation: 710

How to select DISTINCT rows in mySQL DB using NodeJs ORM module?

I am using orm2 module of NodeJs for my DB works but i am stuck at the place where i need to select distinct rows from MYSQL.

thanks in advance.

Upvotes: 1

Views: 1012

Answers (1)

bcmcfc
bcmcfc

Reputation: 26805

According to this pull request, you can do:

Person.aggregate().distinct('country').get(function (err, countries) {
    // countries should be an Array like [ 'country1', 'country2', ... ]
});

Upvotes: 2

Related Questions