Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
Unable to run a javascript file from docker to populate mongo db using WSL shell (windows 10)

I am trying to run a script to populate my mongo db but everytime i get those errors, when i do docker ps the container is up and running:

Note: i'm on windows 10 using WSL shell

enter image description here

What am i doing wrong ? Thanks a lot.

This is the import_script.js that i am trying to run :

use ulaval

db.professeurs.insert(
    [{
        "prenom":"Etienne",
        "nom":"Marceau",
        "cours":"ACT-3000",
        "faculte":"fsg",
        "ecole":"ulaval",
        "cours_derniere_session":["ACT-7002","ACT-2001"]
    },
    {
        "prenom":"Jean-Thomas",
        "nom":"Baillargeon",
        "cours":"GLO-4035",
        "faculte":"fsg",
        "ecole":"ulaval",
        "age":32
    },
    {
        "prenom":"Julie",
        "nom":"Langevin",
        "faculte":"fmd",
        "ecole":"ulaval"
    },
    {
        "prenom":"Richard",
        "nom":"Khoury",
        "faculte":"fsg",
        "ecole":"ulaval",
        "cours_derniere_session":["GLO-7027"]
    },
    {
        "prenom":"Luc",
        "nom":"Lamontagne",
        "cours":"IFT-7022",
        "faculte":"fsg",
        "ecole":"ulaval"
    },
    {
        "prenom":"Philippe",
        "nom":"Gregoire",
        "cours":"GSF-2103",
        "faculte":"fsa",
        "ecole":"ulaval"
    },
    {
        "prenom":"Philippe",
        "nom":"Gregoire",
        "cours":"GSF-2103",
        "faculte":"fsa",
        "ecole":"ulaval"
    }]
)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It can be related to windows line breaks (CRLF) which are used in your javascript file https://prnt.sc/1sc3w17. Mongo shell runner (if you run it inside of docker container based on Linux) requires UNIX style line breaks (LF) that's why you see the syntax errors. You can replace line endings manually in any text editor or use some console tool like this one dos2unix https://www.npmjs.com/package/dos2unix

https://sourceforge.net/projects/dos2unix

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!