We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db.collection.distinct('xxx',function(err,docs){...}) I used it like this,but it seems not correct.
The text was updated successfully, but these errors were encountered:
The only way I got distinct working with mongo skin is by doing this :
var store = mongo.db(connectionString, ackOptions); store.open(function(err,resp){ resp.collection(this.options.collection, {strict: true}, function(err, myCollection) { myCollection.distinct('tag',function(err,res){ console.log(err) console.log(res) }) }); })
Sorry, something went wrong.
Distinct function goes via native MongoDB driver, no code is added by MongoSkin AFAIK. distinct returns an array of keys, but only that.
distinct
distinct(key, query, callback)
You can use the result at the callback as a new query.
Imagine you want to get all the authors who greeted at least once in their posts:
var collection = this.db.collection('posts'); collection.distinct( "author", { message: /^hi/ }, function(error, keys) { collection.findItems({ "author": { $in: keys} }, function (error, results) { if (!error) { console.log(results) } }); });
This works for me, I hope this issue can be closed.
No branches or pull requests
db.collection.distinct('xxx',function(err,docs){...})
I used it like this,but it seems not correct.
The text was updated successfully, but these errors were encountered: