Meteor-Unity  3
A C#-based SDK for connecting Unity to Meteor servers
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Events | List of all members
Meteor.Collection< TRecordType > Class Template Reference

A Mongo collection corresponding to your More...

Inheritance diagram for Meteor.Collection< TRecordType >:

Public Member Functions

 Collection (string name)
 Creates a new Mongo-style collection. Throws an exception if a collection with the given name already exists. If you want a way to get an existing collection instance if it already exists, use Collection<TRecordType>.Create(name) More...
 
Cursor< TRecordType > Find (Func< TRecordType, bool > selector=null)
 Finds documents that match the specified selector. More...
 
Cursor< TRecordType > Find (string id)
 Returns a cursor matching the single ID. Useful for a subsequent observe. More...
 
Cursor< TRecordType > Find (IEnumerable< string > ids)
 Returns a cursor matching an array of document IDs. More...
 
TRecordType FindOne (string id)
 Finds and returns a single document matching the ID. More...
 
TRecordType FindOne (Func< TRecordType, bool > selector=null)
 Finds documents matching the selector and returns the first one matching the selector, in arbitrary order. Throws an exception if none is found. More...
 
void Insert (TRecordType record)
 Inserts a record. Currently not supported. This is a client only representation of the collection. In order to insert documents, define a method on the server that performs the insert, and call that method. The features of the More...
 
void Update (string id, IDictionary mongoUpdateCommand, IDictionary mongoUpdateOptions)
 Updates a record. Currently not supported. This is a client only representation of the collection. In order to update documents, define a method on the server that performs the update, and call that method. The features of the More...
 

Static Public Member Functions

static Collection< TRecordType > Create (string name)
 Creates a collection for the specified name. You can call this multiple times and it will return the same instance of a collection if it was already declared somewhere else. More...
 

Public Attributes

string name
 The collection name corresponding to your Meteor code's new Mongo.Collection(name) statement More...
 

Protected Member Functions

override string GetKeyForItem (TRecordType item)
 

Static Protected Member Functions

static Collection< TRecordType > Create (string name, Collection< TRecordType > instance)
 
static Collection< TRecordType > Convert (string name, Collection< TRecordType > instance)
 

Events

Action< string, TRecordType > WillAddRecord
 Raised before a documented is added. The first parameter is the document's id, and the second is the record data. More...
 
Action< string, TRecordType > DidAddRecord
 Raised after a documented is added. The first parameter is the document's id, and the second is the record data. More...
 
Action< string, TRecordType, IDictionary, string[]> WillChangeRecord
 Raised before a document is changed. The first parameter is the record id, the second is the record before changes, the third is a dictionary of changes and the last is the list of cleared fields, if any. More...
 
Action< string, TRecordType, IDictionary, string[]> DidChangeRecord
 Raised after a document is changed. The first parameter is the record id, the second is the new record, the third is a dictionary of changes and the last is the list of cleared fields, if any. More...
 
Action< string > WillRemoveRecord
 Raised before a document is removed. The first parameter is the record's id. More...
 
Action< string > DidRemoveRecord
 Raised after a document is removed. The first parameter is the record's id. More...
 

Detailed Description

A Mongo collection corresponding to your

new Mongo.Collection statements in Meteor. Calling this function is analogous to declaring a model in a traditional ORM (Object-Relation Mapper)-centric framework. It sets up a collection (a storage space for records, or "documents") that can be used to store a particular type of information, like users, posts, scores, todo items, or whatever matters to your application. Each document is a EJSON object. It includes an _id property whose value is unique in the collection, which Meteor will set when you first create the document.

Type Constraints
TRecordType :MongoDocument 
TRecordType :new() 

Constructor & Destructor Documentation

Meteor.Collection< TRecordType >.Collection ( string  name)
inline

Creates a new Mongo-style collection. Throws an exception if a collection with the given name already exists. If you want a way to get an existing collection instance if it already exists, use Collection<TRecordType>.Create(name)

Parameters
nameName corresponding to your Meteor code's new Mongo.Collection(name) statement. If null, returns a local-only collection.

Member Function Documentation

static Collection<TRecordType> Meteor.Collection< TRecordType >.Create ( string  name)
inlinestatic

Creates a collection for the specified name. You can call this multiple times and it will return the same instance of a collection if it was already declared somewhere else.

Parameters
nameThe name of the collection corresponding to your Meteor code's new Mongo.Collection(name) statement.
Cursor<TRecordType> Meteor.Collection< TRecordType >.Find ( Func< TRecordType, bool >  selector = null)
inline

Finds documents that match the specified selector.

Parameters
selectorSelector. For example, record => record.type == 1 returns all documents whose "type" field matches "1". This is a standard function that should return true when the document matches.
Cursor<TRecordType> Meteor.Collection< TRecordType >.Find ( string  id)
inline

Returns a cursor matching the single ID. Useful for a subsequent observe.

Parameters
idDocument ID.
Cursor<TRecordType> Meteor.Collection< TRecordType >.Find ( IEnumerable< string >  ids)
inline

Returns a cursor matching an array of document IDs.

Parameters
idsDocument IDs.
TRecordType Meteor.Collection< TRecordType >.FindOne ( string  id)
inline

Finds and returns a single document matching the ID.

Returns
A matching document. Throws an exception if none is found.
Exceptions
System.Collections.Generic.KeyNotFoundExceptionThrows if the specified document does not exist.
Parameters
idThe document ID.
TRecordType Meteor.Collection< TRecordType >.FindOne ( Func< TRecordType, bool >  selector = null)
inline

Finds documents matching the selector and returns the first one matching the selector, in arbitrary order. Throws an exception if none is found.

Returns
A matching document.
Exceptions
System.Collections.Generic.KeyNotFoundExceptionThrows if the specified document does not exist.
Parameters
selectorSelector.
void Meteor.Collection< TRecordType >.Insert ( TRecordType  record)
inline

Inserts a record. Currently not supported. This is a client only representation of the collection. In order to insert documents, define a method on the server that performs the insert, and call that method. The features of the

insecure package, like client-side inserts, are not supported.

Parameters
recordRecord.
void Meteor.Collection< TRecordType >.Update ( string  id,
IDictionary  mongoUpdateCommand,
IDictionary  mongoUpdateOptions 
)
inline

Updates a record. Currently not supported. This is a client only representation of the collection. In order to update documents, define a method on the server that performs the update, and call that method. The features of the

insecure package, like client-side updates, are not supported.

Parameters
idIdentifier.
mongoUpdateCommandMongo update command.
mongoUpdateOptionsMongo update options.

Member Data Documentation

string Meteor.Collection< TRecordType >.name

The collection name corresponding to your Meteor code's new Mongo.Collection(name) statement

Event Documentation

Action<string,TRecordType> Meteor.Collection< TRecordType >.DidAddRecord

Raised after a documented is added. The first parameter is the document's id, and the second is the record data.

Action<string,TRecordType,IDictionary,string[]> Meteor.Collection< TRecordType >.DidChangeRecord

Raised after a document is changed. The first parameter is the record id, the second is the new record, the third is a dictionary of changes and the last is the list of cleared fields, if any.

Action<string> Meteor.Collection< TRecordType >.DidRemoveRecord

Raised after a document is removed. The first parameter is the record's id.

Action<string,TRecordType> Meteor.Collection< TRecordType >.WillAddRecord

Raised before a documented is added. The first parameter is the document's id, and the second is the record data.

Action<string,TRecordType,IDictionary,string[]> Meteor.Collection< TRecordType >.WillChangeRecord

Raised before a document is changed. The first parameter is the record id, the second is the record before changes, the third is a dictionary of changes and the last is the list of cleared fields, if any.

Action<string> Meteor.Collection< TRecordType >.WillRemoveRecord

Raised before a document is removed. The first parameter is the record's id.


The documentation for this class was generated from the following file: