mongosh --file seed.js

Category: Databases & SQL

mongosh --file seed.js

Run a JavaScript script file

Executes seed.js as a mongosh script; combine with --nodb to run without connecting, or with a connection string to target a server. Scripts can use db, print, and helpers like load(). Related: --eval for one-liners.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.