MeteorCollection

Undocumented

  • Undocumented

  • Returns the number of documents in the collection

    Declaration

    Swift

    public var count:Int
  • Initializes a MeteorCollection object

    Declaration

    Swift

    public override init(name: String)

    Parameters

    name

    The string name of the collection (must match the name of the collection on the server)

  • Find a single document by id

    Declaration

    Swift

    public func findOne(id: String) -> T?

    Parameters

    id

    the id of the document

  • Invoked when a document has been sent from the server.

    Declaration

    Swift

    public override func documentWasAdded(collection:String, id:String, fields:NSDictionary?)

    Parameters

    collection

    the string name of the collection to which the document belongs

    id

    the string unique id that identifies the document on the server

    fields

    an optional NSDictionary with the documents properties

  • Invoked when a document has been changed on the server.

    Declaration

    Swift

    public override func documentWasChanged(collection:String, id:String, fields:NSDictionary?, cleared:[String]?)

    Parameters

    collection

    the string name of the collection to which the document belongs

    id

    the string unique id that identifies the document on the server

    fields

    an optional NSDictionary with the documents properties

    cleared

    Optional array of strings (field names to delete)

  • Invoked when a document has been removed on the server.

    Declaration

    Swift

    public override func documentWasRemoved(collection:String, id:String)

    Parameters

    collection

    the string name of the collection to which the document belongs

    id

    the string unique id that identifies the document on the server

  • Client-side method to insert a document

    Declaration

    Swift

    public func insert(document: T)

    Parameters

    document

    a document that inherits from MeteorDocument

  • Client-side method to update a document

    Declaration

    Swift

    public func update(document: T, withMongoOperation operation: [String:AnyObject])

    Parameters

    document

    a document that inherits from MeteorDocument

    operation

    a dictionary containing a Mongo selector and a json object

  • Client-side method to update a document

    Declaration

    Swift

    public func update(document: T)

    Parameters

    document

    a document that inherits from MeteorDocument

  • Client-side method to remove a document

    Declaration

    Swift

    public func remove(document: T)

    Parameters

    document

    a document that inherits from MeteorDocument