简体   繁体   English

Mongo DB在Rockmongo中查找查询

[英]Mongo DB find query in Rockmongo

Very simple question, trying to run some simple queries in the "execute" part of rock mongo i have this function 非常简单的问题,尝试在Rock mongo的“执行”部分中运行一些简单查询,我有此功能

function () {
var bla = db.login.find({userData: {userId:'12339'}}).count();
return bla;
}

the response is correct { "retval": 2, "ok": 1 } 响应是正确的{“ retval”:2,“ ok”:1}

if i remove the .count() in the end and make the function like this 如果我最后删除.count()并使函数像这样

function () {
var bla = db.login.find({userData: {userId:'12339'}});
return bla;}

the response is 响应是

{
   "retval": {
     "value": "DBQuery: bet.login -> undefined" 
  },
   "ok": 1 
}

Can any one help me perform a simple find... 谁能帮我进行简单的查找...

Try codes below, should works well: 尝试以下代码,效果很好:

function () {
 var bla = db.login.find({userData: {userId:'12339'}}).next();
 return bla;
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM