我找到了mongo-hacker项目,但它不支持Windows,所以我想知道有人知道类似的吗?
答案 0 :(得分:4)
老实说,我找不到与Windows相关的限制,除了:
Makefile
和README
_isWindows()
mongo_hacker.js
我已经在* nix和Windows中使用了很长时间的Mongo DB,而我遇到的唯一区别是Win版本中没有--fork
param。
那么我会尝试做什么(在Win7中):
_isWindows()
行--shell
命令在某个测试数据库上启动mongo终端,只是为了玩这个 mongo localhost/test --shell mongo_hacker_custom.js
然后,如果一切正常,您可以使用~/.mongorc.js
内容填充mongo_hacker_custom.js
,而无需创建符号链接(BTW,从Vista开始Windows也支持它们,因此符号链接也适用)。
P.S。现在我无法尝试这个解决方案,我会在几个小时内检查建议的解决方案。
UPD :是的,它似乎在我的Windows 7 + MongoDB 2.2.1上工作得很好
答案 1 :(得分:3)
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 !
答案 2 :(得分:0)
该行的唯一原因是由于ANSI着色在Windows终端/ cmd窗口中不起作用(Esc
字符得到输出而不是解释)。
禁用着色(有几种方法但排空'常数'或NOPing低级调用,所有内容最终调用两种方法)并删除对窗口的检查以便能够使用它。
你的另一个选择是在screen
下运行它,因为输出颜色至少在那里工作(但由于某种原因不是提示颜色)。