-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
Affects Version/s: 1.6.0
-
Component/s: AsyncRewriter
-
Not Needed
I try to migrate my scripts from legacy shell to new mongosh. In a class constructor I call db.hostInfo(). I cannot read any properties from result:
class HostInfo {
constructor() {
this.info = (async () => { return db.hostInfo(); })();
}
}
h = new HostInfo()
typeof h.info.system
=> undefined
I tried several variants, none of them is working:
(async () => { return db.adminCommand({ hostInfo: 1 }) })();
(async () => { return JSON.parse(db.hostInfo()) })();
(async () => { return db.hostInfo().toString() })();
(async () => { return db.hostInfo().system })();
(async () => { return db.hostInfo().system.toString() })();
According to https://www.mongodb.com/docs/mongodb-shell/write-scripts/limitations/ I would it expect to work (it was working fine in legacy shell)
Kind Regards
Wernfried