Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8285933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:35:10+00:00 2026-06-08T11:35:10+00:00

I have a function defined called func1 in file file_a.js I have another file

  • 0

I have a function defined called func1 in file file_a.js

I have another file file_b.js, in which I want to use the function func1.
Can I do this inside mongo environment?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:35:11+00:00Added an answer on June 8, 2026 at 11:35 am

    Amended answer thanks to AD7six
    Mongodb console can take multiple input file loaded in order specified.

    Or you can use the built in load function like this

    ➜  mongotest  cat test.js
    load("test2.js");
    print("test.js");
    foo();
    ➜  mongotest  cat test2.js
    var foo = function() {
      print("test2.js");
    };
    
    ➜  mongotest  mongo test.js
    MongoDB shell version: 2.0.6
    connecting to: test
    test.js
    test2.js
    

    test.js is the file given to mongodb console, it loads test2.js(containing function foo) and calls foo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Javascript function defined in the main index.html file. One part of this
I have a function in an app called email which I want to profile.
I have a function defined in a module called DataAccess like this module DataAccess
I have a function defined in jquery closure and called by another function in
I have a module called nbemail.py and in this module I want to use
I have a function, where if a variable is not defined, exit; is called,
I have a function defined like this: public static void ShowAbout(Point location, bool stripSystemAssemblies
I have a function defined inside the script tags of head.(in a JSP) I
Suppose I have a function defined like this: class Foo() { public: void bar(MyClass*
In an ASP.MVC application, I have a function defined in my _ViewStart.cshtml like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.