Mongodb 是否有针对windows的mongo shell扩展?
我找到了这个项目,但它不支持Windows,所以我想知道有人知道类似的吗?老实说,我找不到与Windows相关的限制,除了:Mongodb 是否有针对windows的mongo shell扩展?,mongodb,mongo-shell,Mongodb,Mongo Shell,我找到了这个项目,但它不支持Windows,所以我想知道有人知道类似的吗?老实说,我找不到与Windows相关的限制,除了: *Makefile和README (其中说明WinXP不受2.2支持) 在mongo\u hacker.js 我在*nix和Windows中使用Mongo DB已经有相当长的时间了,唯一的区别是Win版本中缺少--forkparam 那么我将尝试做什么(在Win7 f.e中): 删除\u isWindows()行 使用--shell命令在某个测试数据库上启动mong
- *
和Makefile
README
- (其中说明WinXP不受2.2支持)
- 在
mongo\u hacker.js
--fork
param
那么我将尝试做什么(在Win7 f.e中):
- 删除
行\u isWindows()
- 使用
命令在某个测试数据库上启动mongo终端,只是为了玩这个--shell
mongo localhost/test——shell mongo\u hacker\u custom.js
然后,如果一切正常,您可以使用mongo\u hacker\u custom.js
内容填充~/.mongorc.js
,而无需创建符号链接(顺便说一句,从Vista开始Windows也支持它们,因此符号链接也适用)
另外,现在我不能尝试这个解决方案,我会在几个小时内亲自查看建议的解决方案
UPD:是的,它在我的Windows 7+MongoDB 2.2.1上似乎工作得很好产生这一行的唯一原因是ANSI着色在Windows终端/cmd窗口中不起作用(Esc字符得到输出而不是解释) 禁用着色(有几种方法,但清空“常量”或取消低级调用,所有操作都会调用这两种工作),并删除windows能够使用它的检查 另一种选择是在
屏幕下运行它,因为输出颜色至少在那里起作用(但出于某种原因,提示颜色不起作用)
在windows上可以工作,但需要做一些工作:
-----------------------------------
1) 创建自己的mongo配置文件(.mongorc.js)
-----------------------------------
这位于您的文档中:
%USERPROFILE%\.mongorc.js
例如C:\Users\Olivier\.mongorc.js
A) 将所有来自mongo hacker的文件合并成一个大JS文件。
-----------------------------------
A.1。如果您有cygwin(或某些unix仿真工具):
也许有更好的方法来实现这一点,但这会奏效。
解压.zip文件后,您将进入\mongo hacker master\hacks
查找。/-键入f-name“*.js”| xargs cat>.mongorc.js
然后可以将此文件移动到文档中。
A.2。其他:
或者,如果更方便的话,这里是我的版本(编写时为V0.0.4):
下载:
并将此文件复制到您的文档中。
-----------------------------------
2) 使着色工作正常:
-----------------------------------
A) 下载:
-----------------------------------
这将处理Windows控制台程序的ANSI转义序列。
B) 将此添加到您的windows路径
-----------------------------------
要到达那里:
>点击开始菜单
>右击电脑
>性质
>高级系统设置
>环境变量
到达后,在第2部分(系统变量)中:
您将看到变量:
路径
>单击其值,并将路径添加到ansicon.exe程序,例如:
C:\ProgramFiles\ansicon\x64;
C) 然后
-----------------------------------
现在,您可以使用ansicon作为命令的前缀,以使着色正常工作:例如:
$ansicon.exe mongodb
-----------------------------------
3) 得到一个合适的外壳
-----------------------------------
开箱即用的windows shell(cmd.exe)就是它的原形,
我真的建议你买一个合适的贝壳。
例如:这是一个非常好的程序。
我希望这有帮助!
嗯,我试过了,输出着色对我不起作用,对你也不起作用吗?不,着色对我不起作用,但我在测试它的方法助手,它还向我显示了一些元信息,比如服务器/数据库
mongo-hacker does work on windows but a little work is required :
-----------------------------------
1) Make your own mongo configuration file (.mongorc.js)
-----------------------------------
This is located in your documents :
%USERPROFILE%\.mongorc.js
eg. C:\Users\Olivier\.mongorc.js
A) Make all files from mongo-hacker into one big JS file.
-----------------------------------
A.1. If you have cygwin (or some unix emulation tools) :
There might be a better way to achieve this but this will work.
Once the .zip file is unzipped, and your are in \mongo-hacker-master\hacks
find ./ -type f -name "*.js" | xargs cat > .mongorc.js
You can then move this file to your documents.
A.2. Else :
Or, if more convenient here is my version (v 0.0.4 at the time of writting) :
Download : .mongorc.js example for windows
And copy this file in your documents.
-----------------------------------
2) Get the coloring working :
-----------------------------------
A) Download : ansicon
-----------------------------------
This processes ANSI escape sequences for Windows console programs.
B) Add this to your windows path
-----------------------------------
To get there :
> Click on start menu
> Right click on computer
> Properties
> Advanced system settings
> Environment variables
Once there, in the 2nd section (system variables) :
You will see variable :
Path
> Click on its value, and add the path to the ansicon.exe program, eg :
C:\Program Files\ansicon\x64;
C) Then
-----------------------------------
You can now prefix your command with ansicon to get the coloring working : eg :
$ ansicon.exe mongodb
-----------------------------------
3) Get a proper shell
-----------------------------------
The out of the box windows shell (cmd.exe), being what it's,
I'd really recommand that you get a proper shell.
For example : console is a very nice program.
I hope this helps !