通过shell脚本对MongoDB进行自动化操作

运行写好的 ./show.sh 脚本 发现能够建立mongo链接

#!/bin/sh
mongo WordPress --eval "show collections;db.posts.find().limit(10);"

或者把mongo作为shell解析器:

#!/usr/bin/env mongo WordPress
show collections
db.posts.find().limit(10)

相关文章:

  • 2021-09-11
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-09-25
猜你喜欢
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案