简体   繁体   English

有没有办法通过和尚称呼“独特”?

[英]Is there a way to call 'distinct' through monk?

I want to execute the following 'query' on my node.js server: 我想在node.js服务器上执行以下'query':

MongoDB: MongoDB的:

db.example.distinct('field')

Expected result: [value1, value2, ..., etc] 预期结果:[value1,value2,...等]

I tried this Javascript, but it doesn't work: 我试过这个Javascript,但它不起作用:

db.get('example').distinct('field', function (err, array){...});

But I don't think monk has that method defined. 但我不认为和尚定义了这种方法。 Is there a way to do this? 有没有办法做到这一点?

It's been added to monk. 它被添加到和尚。 Here's the commit 这是提交

Here's the signature 这是签名

Collection.prototype.distinct = function (field, query, fn) {}

Are you using the latest version? 你使用的是最新版本吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Monk中使用fineOne(),find()函数的正确方法 - The right way to use fineOne(), find() functions in Monk 如何使用monk / node.js调用mongodb函数? - How to call a mongodb function using monk/node.js? 有没有办法通过使用僧侣来简化内容(从 mongodb 数据中检索到的列之一)? - Is there any way to simplify the content (one of the column retrieved from the mongodb data) by using monk? 有没有办法通过对spoj的Rest调用来检索用户提交的统计信息? - Is there any way to retrieve a user submissions statistics through a Rest call on spoj? 是否始终需要在整个链中(或依次)始终调用对象? - Is it always required to call an object all the way through the chain (or in order)? 有没有办法通过ajax调用返回由javascript呈现的JSON - Is there a way to return JSON rendered by javascript through ajax call 在ReactJS上调用继承方法(通过“ props”)的最佳方法是什么? - What is the best way to call inherited method (through 'props') on ReactJS? 我可以通过哪种方式通过 JavaScript 类中的方法调用 - In which way can i pass through a method call in JavaScript class 通过和 IF 语句(A-Frame animation 混音器)调用 animation 的正确方法? - Correct way to call animation through and IF statement (A-Frame animation mixer)? MongoDB findAndModify不能和尚一起使用 - MongoDB findAndModify not working with monk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM