我有这条线:
@users = database['users'].find(:all).limit(10)
它返回这个对象:
<Mongo::Cursor:0x8759a858 namespace='app-development.users' @selector=:all @cursor_id=>
我认为它收集了从数据库中获得的 10 个用户。那是对的吗?我尝试像这样迭代它:
@users.each {
|info|
logger.debug ".....................single user: " + info.inspect
}
但我收到了这个错误:
BSON::InvalidDocument (BSON.serialize takes a Hash but got a Symbol):
帮助不胜感激!