如何在Rockmongo或mongovue中执行shell一些查询?

use*_*951 6 mongodb

我在mongo.exe中执行了一个命令.让我们尝试最基本的命令.

> db.tablebusiness.find({"_id": "the-simmons-paradise__41.85_-87.88"});
Run Code Online (Sandbox Code Playgroud)

我得到了结果:

现在我在rockmongo尝试类似的命令.如果我执行

db.tablebusiness.find(
    {"_id": "the-simmons-paradise__41.85_-87.88"}
    );
Run Code Online (Sandbox Code Playgroud)

结果:

{
   "retval": null,
   "ok": 1
} 
Run Code Online (Sandbox Code Playgroud)

基本上它似乎告诉我结果是好的或类似的东西?我不确定.

如果我详细说明:

var cur = db.tablebusiness.find(
{"_id": "the-simmons-paradise__41.85_-87.88"}
);
cur.forEach(function(x){print(tojson(x))});
Run Code Online (Sandbox Code Playgroud)

结果:

{
   "retval": null,
   "ok": 1
} 
Run Code Online (Sandbox Code Playgroud)

同样的问题.

如果我做:

function () {
   return db.tablebusiness.find({"_id": "the-simmons-paradise__41.85_-87.88"});
}
Run Code Online (Sandbox Code Playgroud)

我有:

 {
   "retval": {
     "value": "DBQuery: hello.tablebusiness -> undefined"
  },
   "ok": 1
}   
Run Code Online (Sandbox Code Playgroud)

hello.tablebusiness是什么意思 - > undefined超出了我的意思.从上面看,我在mongo.exe中成功执行了查询

看起来像rockmongo的功能非常有限.我想知道如何真正看到结果.如何在rockmongo中执行随机mongodb命令并观察结果.

小智 8

首先,我同意你的看法:rockmongo目前的功能非常有限.我将它用于简单查询,因为我可以从任何支持浏览的设备访问我的远程服务器.

rockmongo中的"执行"区域使用"Javascript API"运行,而不像mongo shell.

试试这个:

function () {
    var cur = db.tablebusiness.find(
    {"_id": "the-simmons-paradise__41.85_-87.88"}
    );
    var out = [];
    cur.forEach(function(x){out.push(x);});
    return(out);
}
Run Code Online (Sandbox Code Playgroud)

您可以单击集合名称运行简单查询,在上部区域键入查询条件...

 {"_id": "the-simmons-paradise__41.85_-87.88"}
Run Code Online (Sandbox Code Playgroud)

...然后"提交查询"