Mongoimport failing in GitLab continuous integration with 0B

We are running into an issue with mongoimport during continuous integration, using a GitLab runner, whereby it loops with progress being “0B/139KB”:

running: mongoimport -v -c coaches --uri=mongodb://mongo:27017/myproj-test --type=json --file=test_data/mongo_dump/coaches.json --stopOnError
stderr: 2022-09-23T17:41:24.041+0000	filesize: 142688 bytes
stderr: 2022-09-23T17:41:24.042+0000	using fields: 
stderr: 2022-09-23T17:41:27.048+0000	[........................] myproj-test.coaches	0B/139KB (0.0%)
stderr: 2022-09-23T17:41:30.047+0000	[........................] myproj-test.coaches	0B/139KB (0.0%)
stderr: 2022-09-23T17:41:33.047+0000	[........................] myproj-test.coaches	0B/139KB (0.0%)
stderr: 2022-09-23T17:41:36.047+0000	[........................] myproj-test.coaches	0B/139KB (0.0%)

This is called as part of our test suite, to bootstrap the database prior to testing. It works locally when I try on my Mac, but not in the “nodejs:16” build image.

We are using mongo-tools, which apt indicates as being: “mongo-tools/oldstable 3.4.14-4 amd64”.

Can anyone indicate what I could be doing next to work out what is wrong or solve the issue?

Hi @Andre-John_Mas1 ,

“mongo-tools/oldstable 3.4.14-4 amd64”.

What version of MongoDB server are you connecting to? 3.4.14 is a very old (and end-of-life) version of MongoDB tools released in March, 2018.


Running the code below in NodeJS, I am getting 6.0.1:

async function getMongoVersion(config) {
    const mongoUrl = config.url;
    const mongoClient = await mongoConnect(mongoUrl, {
        useNewUrlParser: true,
        useUnifiedTopology: true

    const database = mongoClient.db();
    if (database) {
        const adminDb = database.admin();
        const serverInfo = await adminDb.serverStatus();
        return serverInfo.version;
    return undefined;

I’ll explore how to get the most recent client tools onto this runner. Right now their runner image for nodejs 16, gives the following as environment:

$ grep NAME /etc/*-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
$ uname -a
Linux runner-jlguopmm-project-11773380-concurrent-0 5.4.109+ #1 SMP Wed Jun 16 20:00:10 PDT 2021 x86_64 GNU/Linux

It looks like it was indeed the old version of the mongo-tools that was causing the issues.

I have now added the following lines to our CI configuration, in the before_script section, based on the community edition instructions:

  - wget -qO - | apt-key add -
  - echo "deb buster/mongodb-org/6.0 main" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
  - apt-get update
  - apt-get install -y mongodb-org-tools

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.