     Synchronously returns an array of Object type for the given keys, with an array of keys which don't have
     corresponding objects in the database.
 
-        let (people: [Person], missing) = transaction.filterExisting(keys)
+        let (people: [Person], missing) = connection.filterExisting(keys)
 
     :param: keys An array of String instances
     :returns: An ([Object], [String]) tuple.

}


// MARK: - YapDatabaseConnection

extension YapDatabaseConnection {


extension YapDatabase {

    /**
    Asynchronously reads all the items in the database for a particular Persistable Object in a new connection.
    Example usage:

        database.readAll() { (people: [Person] in }

    :returns: An array of Object types.
    */
    public func asyncReadAll<Object where Object: Persistable>(queue: dispatch_queue_t = dispatch_get_main_queue(), completion: ([Object]) -> Void) {
        newConnection().asyncReadAll(queue: queue, completion: completion)
    }

    /**
    Asynchronously reads all the items in the database for a particular Persistable Value in a new connection.
    Example usage:

        database.readAll() { (barcodes: [Barcode] in }

    :returns: An array of Object types.
    */
    public func asyncReadAll<Value where Value: Saveable, Value: Persistable, Value.ArchiverType.ValueType == Value>(queue: dispatch_queue_t = dispatch_get_main_queue(), completion: ([Value]) -> Void) {
        newConnection().asyncReadAll(queue: queue, completion: completion)
    }
}

extension YapDatabase {

    /**
    Synchronously returns an array of Object type for the given keys, with an array of keys which don't have
    corresponding objects in the database, using a new connection.

        let (people: [Person], missing) = database.filterExisting(keys)

    :param: keys An array of String instances
    :returns: An ([Object], [String]) tuple.
    */
    public func filterExisting<Object where Object: Persistable>(keys: [String]) -> (existing: [Object], missing: [String]) {
        return newConnection().filterExisting(keys)
    }

    /**
    Synchronously returns an array of Value type for the given keys, with an array of keys which don't have
    corresponding values in the database, using a new connection.

        let (barcode: [Barcode], missing) = database.filterExisting(keys)

    :param: keys An array of String instances
    :returns: An ([Value], [String]) tuple.
    */
    public func filterExisting<Value where Value: Saveable, Value: Persistable, Value.ArchiverType.ValueType == Value>(keys: [String]) -> (existing: [Value], missing: [String]) {
        return newConnection().filterExisting(keys)
    }
}

