我需要帮助在 mongoexport 期间在查询中指定参数值。
这是示例
-q '{Id:{$eq:"$ID"}}',
我ID=$1
在 Bash shell 脚本中指定,但是当调度程序运行它时,它没有导出任何东西。这里 ID 是集合中的一列。
脚本如下
#!/bin/bash
ID=$1
mongoexport -u test -p test --authenticationDatabase admin -d test -c test -q '{Id:{$eq:"$ID"}}' -o test.json