MongoDB:修改命令行提示符
Shell:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@mongodb ~]# cat ~/.mongorc.js prompt = function() { if (typeof db == 'undefined'){ return '(nodb)> '; } try{ db.runCommand({getLastError:1}); } catch (e) { print(e); } return (new Date())+" ##--> "+db+"> "; }; EDITOR="/usr/bin/vi"; [root@mongodb ~]# [root@mongodb ~]# mongo -u "adamhuan" -p "*****" --authenticationDatabase "admin" --quiet Wed Nov 14 2018 23:11:39 GMT+0800 (CST) ##--> test> Wed Nov 14 2018 23:11:41 GMT+0800 (CST) ##--> test> exit; [root@mongodb ~]# |
——————————————————————————
Done。