iriseth
iriseth

Reputation: 1

mongosh --eval returns the result but not the prompt

Have a problem with a mongosh query

tried to query a mongo rs the following way:

mongosh mongodb://xx.yy.zz.kk:27010,xx.yy.zz.ll:27010,kk.yy.zz.ff:27010/somedb --username someuser --password somepassword --authenticationDatabase admin --eval 'db.getCollection("somecollection").findOne();'

it returns the result but never gives me back my (bash shell) prompt.

update: trying the same query from another host on another subnet, returns the result and returns to shell. so its maybe not mongosh related.

Upvotes: 0

Views: 1011

Answers (1)

Wernfried Domscheit
Wernfried Domscheit

Reputation: 59602

When you use --eval then command is executed and shell is terminated afterwards. If you like to keep the shell open use option --shell

Upvotes: 0

Related Questions