Click or drag to resize

Collection Class

Represents a collection of documents.
Inheritance Hierarchy

Namespace:  MySqlX.XDevAPI
Assembly:  MySql.Data (in MySql.Data.dll) Version: 8.0.22
Syntax
public class Collection : DatabaseObject

The Collection type exposes the following members.

Properties
  NameDescription
Public propertyName
Gets the database object name.
(Inherited from DatabaseObject.)
Public propertySchema
Gets the schema that owns the database object.
(Inherited from DatabaseObject.)
Public propertySession
Gets the session that owns the database object.
(Inherited from DatabaseObject.)
Top
Methods
  NameDescription
Public methodAdd
Creates an AddStatement containing the provided objects that can be used to add one or more items to a collection.
Public methodAddOrReplaceOne
Adds the given document to the collection unless the identifier or any other field that has a unique index already exists, in which case it will update the matching document.
Public methodCount
Returns the number of documents in this collection on the server.
Public methodCreateIndex
Creates an index based on the properties provided in the JSON document.
Public methodDropIndex
Drops a collection index.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExistsInDatabase
Verifies if the current collection exists in the server schema.
(Overrides DatabaseObjectExistsInDatabase.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFind
Creates a FindStatement with the given condition which can be used to find documents in a collection.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetOne
Returns the document with the given identifier.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodModify
Creates a ModifyStatement with the given condition that can be used to modify one or more documents from a collection.
Public methodRemove
Creates a RemoveStatement with the given condition that can be used to remove one or more documents from a collection.The statement can then be further modified before execution.
Public methodRemoveOne
Removes the document with the given identifier.
Public methodReplaceOne
Replaces the document matching the given identifier.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Protected methodValidateOpenSession (Inherited from DatabaseObject.)
Top
See Also