<commit_before>import NIO

public struct FindCommand: ReadCommand {
    typealias Reply = CursorReply
    
    internal var namespace: Namespace {
        return find
    }
    
    /// This variable _must_ be the first encoded value, so keep it above all others
    internal let find: Namespace
    
    public var filter: Query?
    public var sort: Sort?
    public var projection: Projection?
    public var skip: Int?
    public var limit: Int?
    public var readConcern: ReadConcern?
    
    public init(filter: Query?, on collection: Collection) {
        self.filter = filter
        self.find = collection.namespace
    }
}

public struct CursorSettings: Encodable {
    var batchSize: Int?
}

struct CursorDetails: Codable {
    var id: Int64
    var ns: String
    var firstBatch: [Document]
}

struct CursorReply: ServerReplyDecodableResult {
    var isSuccessful: Bool {
        return ok == 1
    }
    
    internal let cursor: CursorDetails
    private let ok: Int
    
    func makeResult(on collection: Collection) throws -> Cursor {
        return Cursor(reply: self, in: collection)
    }
}

/// A cursor that results from a `FindCommand`
public final class FindCursor: QueryCursor {
    /// The FindCursor alays results in a `Document`
    public typealias Element = Document
    
    /// The batch size
    public var batchSize = 101<commit_msg>Make CursorDetails nested in CursorReply again<commit_after>import NIO

public struct FindCommand: ReadCommand {
    typealias Reply = CursorReply
    
    internal var namespace: Namespace {
        return find
    }
    
    /// This variable _must_ be the first encoded value, so keep it above all others
    internal let find: Namespace
    
    public var filter: Query?
    public var sort: Sort?
    public var projection: Projection?
    public var skip: Int?
    public var limit: Int?
    public var readConcern: ReadConcern?
    
    public init(filter: Query?, on collection: Collection) {
        self.filter = filter
        self.find = collection.namespace
    }
}

public struct CursorSettings: Encodable {
    var batchSize: Int?
}

struct CursorReply: ServerReplyDecodableResult {
    struct CursorDetails: Codable {
        var id: Int64
        var ns: String
        var firstBatch: [Document]
    }
    
    var isSuccessful: Bool {
        return ok == 1
    }
    
    internal let cursor: CursorDetails
    private let ok: Int
    
    func makeResult(on collection: Collection) throws -> Cursor {
        return Cursor(reply: self, in: collection)
    }
}

/// A cursor that results from a `FindCommand`
public final class FindCursor: QueryCursor {
    /// The FindCursor alays results in a `Document`
    public typealias Element = Document
    
    /// The batch size
    public var batchSize = 101
{'fraction_non_alphanumeric': 0.06583184257602863, 'fraction_numerical': 0.004293381037567084, 'mean_word_length': 2.5846153846153848, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6262717', 'n_tokens_mistral': 783, 'n_tokens_neox': 762, 'n_words': 292}