方法一:
echo "db.testdb.find({'status':'running'}).count()"|/opt/mongodb/bin/mongod 1.0.0.9:8635/test -u 'test' -p "xxxx"
方法二:
/opt/mongodb/bin/mongod 1.0.0.9:8635/test -u 'test' -p "xxxx" -eval "db.testdb.find({}).count()"
方法三:
echo "use test" > test.js
echo "db.testdb.find({}).count()" >> test.js
/opt/mongodb/bin/mongod 1.0.0.9:8635/test -u 'test' -p "xxxx" < test.js
MongoDB数据库shell命令执行
最新推荐文章于 2024-05-14 01:51:51 发布