Show / Hide Table of Contents

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
DisposableObject
ApplicationComponent
MongoClient
Implements
IApplicationComponent
System.IDisposable
IConfigurable
IInstrumentable
IExternallyParameterized
IApplicationFinishNotifiable
INamed
Inherited Members
ApplicationComponent.AllComponents
ApplicationComponent.GetAppComponentBySID(UInt64)
ApplicationComponent.GetAppComponentByCommonName(String)
ApplicationComponent.ComponentSID
ApplicationComponent.ComponentStartTime
ApplicationComponent.ComponentCommonName
ApplicationComponent.ComponentDirector
DisposableObject.DisposeAndNull<T>(T)
DisposableObject.DisposeStarted
DisposableObject.Disposed
DisposableObject.EnsureObjectNotDisposed()
DisposableObject.Dispose()
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)
Namespace: NFX.DataAccess.MongoDB.Connector
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
Type Description
IConfigSectionNode

DefaultLocalServer

Returns ServerNode for local server on a default port

Declaration
public ServerNode DefaultLocalServer { get; }
Property Value
Type Description
ServerNode

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
Type Description
MongoClient

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
Type Description
ServerNode

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
Type Description
IRegistry<ServerNode>

Methods

Configure(IConfigSectionNode)

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
Type Name Description
IConfigSectionNode node

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
Type Description
Database

Destructor()

Declaration
protected override void Destructor()
Overrides
ApplicationComponent.Destructor()

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
Type Name Description
IApplication application

IApplicationFinishNotifiable.ApplicationFinishBeforeCleanup(IApplication)

Declaration
void IApplicationFinishNotifiable.ApplicationFinishBeforeCleanup(IApplication application)
Parameters
Type Name Description
IApplication application

Implements

IApplicationComponent
System.IDisposable
IConfigurable
IInstrumentable
IExternallyParameterized
IApplicationFinishNotifiable
INamed

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX