Add a filter field to the listDatabases command in order to reduce the set of database metadata entries returned. For example, we may only want the list of databases whose names begin with "foo". This could be achieved with the following command:
db.adminCommand({listDatabases: 1, filter: {name: /^foo/}});