Mongo extract hostname field db.hostinfo

Viewed 121

I'm new to Mongo.

I can run db.hostInfo(), and it outputs lots of information, but I just want to see the "system"."hostname" field.

How do i do that ?

Thanks

2 Answers

Type and hit enter =>

db.hostInfo().system.hostname

This command works on Linux(Ubuntu20.04) and Win10.

Related