Run javascript script (.js file) in mongodb including another file inside js

前端 未结 5 523
攒了一身酷
攒了一身酷 2020-12-24 10:14

I want to write a long script for inserting and updating mongodb data.

  1. Is it possible to call external js file that contains the script?
  2. Is it pos
5条回答
  •  误落风尘
    2020-12-24 11:12

    Yes you can. The default location for script files is data/db

    If you put any script there you can call it as

    load("myjstest.js")      // or 
    load("/data/db/myjstest.js")
    

提交回复
热议问题