Class MongoClient
The central facade for working with MongoDB. The technology was tested against Mongo DB 3.+
The NFX MongoDB connector is purposely created for specific needs such as using MongoDB as a device yielding 4x-8x better throughput than the official driver.
It does not support: Mongo security, sharding and replication
Inheritance
System.Object
MongoClient
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: NFX.MongoDB.dll
Syntax
public sealed class MongoClient : ApplicationComponent, IApplicationComponent, IDisposable, IConfigurable, IInstrumentable, IExternallyParameterized, IApplicationFinishNotifiable, INamed
Constructors
MongoClient(String)
Creates a new instance of client.
For most applications it is sufficient to use the default singleton instance Client.Instance
Declaration
public MongoClient(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Fields
CONFIG_CS_DB_ATTR
Declaration
public const string CONFIG_CS_DB_ATTR = "db"
Field Value
Type |
Description |
System.String |
|
CONFIG_CS_ROOT_SECTION
Declaration
public const string CONFIG_CS_ROOT_SECTION = "mongo"
Field Value
Type |
Description |
System.String |
|
CONFIG_CS_SERVER_ATTR
Declaration
public const string CONFIG_CS_SERVER_ATTR = "server"
Field Value
Type |
Description |
System.String |
|
CONFIG_MONGO_CLIENT_SECTION
Declaration
public const string CONFIG_MONGO_CLIENT_SECTION = "mongo-db-client"
Field Value
Type |
Description |
System.String |
|
Properties
ConfigRoot
Returns the config root of the client that was set by the last call to Configure()
or App.CONFIG_MONGO_CLIENT_SECTION (which may be non-existent)
Declaration
public IConfigSectionNode ConfigRoot { get; }
Property Value
DefaultLocalServer
Returns ServerNode for local server on a default port
Declaration
public ServerNode DefaultLocalServer { get; }
Property Value
ExternalParameters
Declaration
public IEnumerable<KeyValuePair<string, Type>> ExternalParameters { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> |
|
Instance
Retrurns the default instance of the Client, lazily crating it on the first access
Declaration
public static MongoClient Instance { get; }
Property Value
InstrumentationEnabled
Declaration
[Config]
public bool InstrumentationEnabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
Item[Node]
Returns an existing server node or creates a new one
Declaration
public ServerNode this[Node node] { get; }
Parameters
Type |
Name |
Description |
Node |
node |
|
Property Value
Name
Declaration
public string Name { get; }
Property Value
Type |
Description |
System.String |
|
Servers
Returns all connected servers
Declaration
public IRegistry<ServerNode> Servers { get; }
Property Value
Methods
Sets config root. If this method is never called then configuration is done of the App.CONFIG_MONGO_CLIENT_SECTION section
Declaration
public void Configure(IConfigSectionNode node)
Parameters
DatabaseFromConnectString(String)
Return a Database instance per supplied connection string in the following form:
mongo{server="mongo://localhost:27017" db="myDB"}
Declaration
public static Database DatabaseFromConnectString(string cString)
Parameters
Type |
Name |
Description |
System.String |
cString |
|
Returns
Destructor()
Declaration
protected override void Destructor()
Overrides
ExternalGetParameter(String, out Object, String[])
Declaration
public bool ExternalGetParameter(string name, out object value, params string[] groups)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Object |
value |
|
System.String[] |
groups |
|
Returns
Type |
Description |
System.Boolean |
|
ExternalParametersForGroups(String[])
Declaration
public IEnumerable<KeyValuePair<string, Type>> ExternalParametersForGroups(params string[] groups)
Parameters
Type |
Name |
Description |
System.String[] |
groups |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>> |
|
ExternalSetParameter(String, Object, String[])
Declaration
public bool ExternalSetParameter(string name, object value, params string[] groups)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Object |
value |
|
System.String[] |
groups |
|
Returns
Type |
Description |
System.Boolean |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.Object.ToString()
Explicit Interface Implementations
IApplicationFinishNotifiable.ApplicationFinishAfterCleanup(IApplication)
Declaration
void IApplicationFinishNotifiable.ApplicationFinishAfterCleanup(IApplication application)
Parameters
IApplicationFinishNotifiable.ApplicationFinishBeforeCleanup(IApplication)
Declaration
void IApplicationFinishNotifiable.ApplicationFinishBeforeCleanup(IApplication application)
Parameters
Implements
System.IDisposable
Extension Methods