                 }
                 
                 let documents = resultDocs.first?["cursor", "nextBatch"] as Document? ?? []
-                for (_, value) in documents {
+                for value in documents.arrayValue {
                     if let doc = transform(value.documentValue ?? [:]) {
                         self.data.append(doc)
                     }

    
    // documents already received by the server
    fileprivate var data: [T]
    
    /// A closure that transforms a document to another type if possible, otherwise `nil`
    typealias Transformer = (Document) -> (T?)

        }
    }
    
    /// Allows you to fetch the first next entity in the Cursor
    public func next() -> T? {
        defer { position += 1 }
        
        if position >= self.data.count && self.cursorID != 0 {
            position = 0
            self.data = []
            // Get more data!
            self.getMore()
        }
        
        return position < self.data.count ? self.data[position] : nil
    }
}

