#Database Testing Method.
socket.on 'databaseTesting', ->
db.collection 'documents', (err, collection) ->
console.log 'Printing documents...'
console.log cursor.item for cursor in collection.find() when cursor.hasNext isnt false
console.log 'Documents printed.'
I am trying to print the contents of this collection to the console of a mongo database running on a nodejs localhost server. The first and last console.log displays fine, but not the cursor itself. And no errors are thrown. Any ideas? The above is CoffeeScript.
A MongoDB cursor is not an array so you should use something like this instead for the second to last line: