---
title: "Discussion on \"Learn how to connect and run script on mongosh\" | Hashnode"
description: "Discussion on \"Learn how to connect and run script on mongosh\". Recently, I needed to write some scripts to run on mongosh and since there will be common code among the scripts. I was wondering if it is possible to write just like any JavaScript file (with import/export) to run on mongosh.\nI also explored a littl..."
url: "https://hashnode.com/posts/learn-how-to-connect-and-run-script-on-mongosh/6354f36700f8dea499065f37"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Learn how to connect and run script on mongosh](https://bwgjoseph.com/learn-how-to-connect-and-run-script-on-mongosh?utm_source=hashnode&utm_medium=feed)

Recently, I needed to write some scripts to run on mongosh and since there will be common code among the scripts. I was wondering if it is possible to write just like any JavaScript file (with import/export) to run on mongosh. I also explored a littl...

Oct 23, 2022 · 6 min read · bwgjoseph.com  
Read the article

-   [#mongosh](https://hashnode.com/tag/mongosh)
-   [#mongodb](https://hashnode.com/tag/mongodb)
-   [#mongodbshell](https://hashnode.com/tag/mongodbshell)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#nodejs](https://hashnode.com/tag/nodejs)

## Written by

[Joseph Gan](https://hashnode.com/@bwgjoseph)

@bwgjoseph · Singapore

  
[View profile](https://hashnode.com/@bwgjoseph)

Advocate for better developer's productivity and experience Documenting my learnings and sharing it

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
