I try run command mongo in linux console without entering into mongo shell. To do it:
[root@router-mongos ~]# mongo --eval " printjson(show databases)"
But not run, this is the output:
MongoDB shell version: 2.6.10 connecting to: test 2015-06-10T18:33:39.834+0200 SyntaxError: Unexpected identifier
Though if you are uses:
[root@router-mongos ~]# mongo maria --eval " printjson (db.stats())" o mongo --eval " printjson(db.adminCommand('listDatabases'))"
Yes, the output is the same if you run it in shell.
Has anyone ever used this? can we help me? Thanks.