The problem is that db.runCommand() does not return a cursor, so none of the cursor methods are going to work on it. You're returning a document with the results nested inside, so you're going to have to work with the data a different way.

You should be able to either use map or each, depending on what you're trying to do: