 import NIO
+import MongoKittenCore
 import MongoClient
 
 extension MongoCollection {

    public typealias Element = Document
    internal var collection: MongoCollection!
    internal var writing = false
    
    public var eventLoop: EventLoop { return collection.eventLoop }
    
    private func makeCommand() -> AggregateCommand {
        var documents = [Document]()

            documents.append(contentsOf: stage.stages)
        }
        
        var command = AggregateCommand(
            inCollection: collection.name,
            pipeline: documents
        )
        
        command.comment = _comment
        command.allowDiskUse = _allowDiskUse
        command.collation = _collation
        command.readConcern = _readConcern
        
        return command
    }
    
    public func getConnection() -> EventLoopFuture<MongoConnection> {
