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
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"
}]
)
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