Workarounds for functions which are not available in new mongosh

Hi @Wernfried_Domscheit, MongoSH is also a node.js environment.

I’m not sure if this is going to help as you may have a lot of code to convert but here are some alternatives:

hostname()

require("os").hostname();

tojsononeline()

const jsonString = EJSON.stringify(obj);

_getEnv()

const home = process.env.HOME;
2 Likes