Implementing a static method for distinct on many fields

13 views
Skip to first unread message

Jeremy Jackson

unread,
Jul 29, 2015, 12:46:48 PM7/29/15
to Mongoose Node.JS ODM
I'm trying to solve what I would think would be a more common problem that people run into with MongoDB, and hence Mongoose.  Coming from a SQL background I would have expected that you could pass many fields into the distinct method and gotten back an object with the distinct values for each field passed in.

For the purposes of my first project using MongoDB & Mongoose where I need something like this I could just tie together an object that contains the distinct values I need but I'd like the code to be more portable.

I've already asked the question and posted a bit of example code on stackoverflow here: http://stackoverflow.com/questions/31683533/no-value-for-distinct-has-been-declared

It would be great to get some help in putting this together.
Reply all
Reply to author
Forward
0 new messages