[DOCS-2543] Don't "echo" to script the mongo javascript shell Created: 16/Jan/14  Updated: 30/Oct/23  Resolved: 01/Oct/19

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Andrew Feierabend (Inactive)
Resolution: Done Votes: 0
Labels: bite-sized
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Location: http://docs.mongodb.org/manual/tutorial/write-scripts-for-the-mongo-shell/#differences-between-interactive-and-scripted-mongo
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0
Screen Resolution: 1920 x 1200
repo: docs
source: tutorial/write-scripts-for-the-mongo-shell


Participants:
Days since reply: 4 years, 19 weeks, 1 day ago
Epic Link: DOCSP-1769
Story Points: 0.25

 Description   

re:http://docs.mongodb.org/manual/tutorial/write-scripts-for-the-mongo-shell/#differences-between-interactive-and-scripted-mongo

We should add a warning that it is not advised to use things like:
echo "db.currentOp()" >> mongo ...

because that runs in interactive mode and does extra, possibly bad things when being automated – runs commands like gle, isMaster, replSetGetStatus, etc.

Instead, the suggestion is to use --eval or js-file, which is much better.



 Comments   
Comment by Andrew Feierabend (Inactive) [ 01/Oct/19 ]

The  --eval  option is already present and adequately documented on this page. No need to bring up an ill-advised alternative.

Comment by Kay Kim (Inactive) [ 24/Sep/16 ]

bulk assigning tickets in backlog to team members to groom.

Generated at Thu Feb 08 07:43:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.