如何在bitbucket管道上访问mongorestore和其他命令?

时间:2018-08-14 18:18:14

标签: mongodb bitbucket bitbucket-pipelines

我试图在运行测试之前使用诸如mongoimport,mongodump和mongorestore之类的命令来准备我的测试数据库,但出现错误“ bash:mongoimport:未找到命令”

我的bitbucket-pipelines.yml文件看起来像:

image: node:8
pipelines:
  branches:
    Development:
      - step:
          name: Test
          caches:
            - node
          services:
            - mongo
          script:
            - mongoimport --uri "testDB" --drop --collection users --file ./seed/users.json
            - mongodump --uri "otherDB" --out "/backups"
            - mongorestore --uri "testDB" --db testDB "/backups/otherDB"
            - npm install
            - npm test
definitions:
  services:
    mongo:
      image: mongo

我不确定为什么我无权访问mongodb命令,我认为运行服务将使我能够轻松执行转储和还原。

0 个答案:

没有答案
相关问题