Attempting to execute a JavaScript (JS) file in order to obtain configuration server information for a shard. While it runs successfully in the mongo shell, the resulting output is too extensive to analyze through the command prompt. To address this issue, I attempted to save the output to a file using the following command:
F:\git\bits-n-pieces\scripts> mongo --shell wts.js aggutil.js \
--eval "printjson(wts('config192'))" > out.log
MongoDB shell version: 2.6.4 connecting to: test
type "help" for help
2015-02-16T15:48:34.088+0530
ReferenceError: wts is not defined
Unfortunately, the attempt to simultaneously load and execute the JS function proved unsuccessful. Is there an alternative method available to execute the JS function and save the output to a file?