Problem with loop script (mongo with js file)

Hi everybody! All ok?

I have a ReplicaSet PSA version 4.2 and i need get 3 informations about space of all databases, datas bellow:
db.stats().dataSize, db.stats().storageSize and db.stats().indexSize

I write one script in mongo shell js file with read listDatabases and execute while to change databases with db.getSiblingDB, but in second loop of while i have this message of error:

[js] Error: [] is not a valid database name :

Obs.: In first loop execute no mistakes. I execute 2 times (db.getSiblingDB commented and uncommented) and send for you the script files and log files. Please, if you have one idea how do i solve this, I’ll be very grateful.

Thanks for your help!

COMMENTED:


Result with comment

UNCOMMENTED:


Thanks, but i solve this with other getSiblingDB:


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.