如何打印mongodb光标?
我正在尝试将此集合的内容打印到运行在nodejs localhost服务器上的mongo数据库的控制台。第一个和最后一个console.log显示良好,但光标本身不显示。并且不会抛出错误。有什么想法吗?上面是CoffeeScript。MongoDB游标不是数组,因此您应该在第二行到最后一行中使用类似的内容:如何打印mongodb光标?,mongodb,coffeescript,Mongodb,Coffeescript,我正在尝试将此集合的内容打印到运行在nodejs localhost服务器上的mongo数据库的控制台。第一个和最后一个console.log显示良好,但光标本身不显示。并且不会抛出错误。有什么想法吗?上面是CoffeeScript。MongoDB游标不是数组,因此您应该在第二行到最后一行中使用类似的内容: #Database Testing Method. socket.on 'databaseTesting', -> db.col
#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.'
collection.find().each (err, item) -> console.log item if item