GitHub / mongodb / docs-mongodb-shell
Documentation for the mongodb shell
JSON API: http://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fdocs-mongodb-shell
PURL: pkg:github/mongodb/docs-mongodb-shell
Stars: 13
Forks: 59
Open issues: 2
License: None
Language: Shell
Size: 3.8 MB
Dependencies parsed at:
90
Created at: over 5 years ago
Updated at: 5 months ago
Pushed at: 5 months ago
Last synced at: 22 days ago
Commit Stats
Commits: 359
Authors: 44
Mean commits per author: 8.16
Development Distribution Score: 0.646
More commit stats: https://commits.ecosyste.ms/hosts/GitHub/repositories/mongodb/docs-mongodb-shell
- 1.Createafilenamed *
- AcompletedescriptionofNode.js ,modules,andthe
- Foranexample ,see
- IncludeExternalFilesandModulesinScripts *
- Instead ,
- Inyour *
- RequireaBuilt-InModule *
- RequireaLocalFile *
- RequireannpmModule *
- Thefollowingexamplecreatesandexecutesascriptthat *
- Toincludeafilenamed *
- Torunthisexample ,youmustinstallthe
- Tousefilesandmodulesinyour *
- YoucanrequireNode.jsmodules *
- Youcanrequirebuilt-inNode.jsmodules *
- Youcanrequireremotenpmmodulesusingthisconstruction *
- YoucanuseJavaScriptfilesin *
- Youroutputmayvarydependingonthedatethatyouruntheexample. *
- additionalsetuporconfiguration. *
- constdocument =db.employees.findOne
- constformatDistance =require
- constfs =require
- constlocalRequire =require
- constsaleDate0 =db.cakeSales.findOne
- constsaleDate1 =db.cakeSales.findOne
- constsaleDateDistance0 =formatDistance
- constsaleDateDistance1 =formatDistance
- contents *
- currentexecutionscope. *
- currentworkingdirectory. *
- db.cakeSales.insertMany *
- db.employees.insertMany *
- followingcommandfrom *
- followingcontents *
- fs.writeFileSync *
- function. *
- functionisoutofscopeforthistutorial.Tolearnmore ,see
- globallyorinthe *
- installthemoduleseither *
- inthe *
- load *
- moduletoformatdates. *
- print *
- require *
- state *
- vartests =require
- withoutanyadditionalsetuporconfiguration. *
- workingdirectory ,useoneofthefollowingcommands
- Accesstothe *
- Availabilityof *
- DifferencesBetween *
- FilePathsfor *
- Forexample ,the
- Generally ,youshouldnotkeepmongosh
- LoadExternalCodeina *
- The *
- Therefore ,youmayobserveunexpectedresultsifyourun
- Thetypeofscriptdetermineshowyouspecifyfilepathswith *
- Theymayexhibitdifferentbehaviorswhenthesamecommandisrunin *
- Tochangetheshell *
- Toloada *
- Toreturnthecurrentworkingdirectoryoftheshell ,runthe
- TypesofScriptsin *
- Usingthe *
- Youcanloadexternalcodeina *
- Youcanusethefollowingtypesofscriptswith *
- availableinsideofNode.jsscripts. *
- codeinsideofaNode.jsscript. *
- constfileExports =localRequire
- constlocalRequire =require
- database *
- dependingonthetypeofscriptyouareusing. *
- eachtypeofscript ,suchasreturningdifferentdatatypes.
- factorssuchaswhere *
- filebeingexecuted. *
- followinglinestoyourscript *
- includingnpmpackages.Thesescriptsarealwaysfiles. *
- interpretedasrelativetothecurrentworkingdirectoryofthe *
- load *
- methodinyourscript. *
- modulefroma *
- packageoraseparate *
- scripts. *
- shell. *
- thattheseparatescriptyouareloadingisnotaffectedbyexternal *
- the *
- variablereturnstheabsolutepathofthedirectorycontainingthe *
- where *
- workingdirectoryoftheshell. *
- yourscriptsforaddedfunctionality.However ,