@Beta public class MongoDataLink extends DataLinkBase
MongoClient
documentation, the client object is responsible for maintaining connection pool,
so this data link just returns one, cached client.Modifier and Type | Field and Description |
---|---|
static String |
CONNECTION_STRING_PROPERTY
Name of a property which holds connection string to the mongodb instance.
|
static String |
DATABASE_PROPERTY
Name of a property with a database name hint.
|
Constructor and Description |
---|
MongoDataLink(DataLinkConfig config)
Creates a new data link based on given config.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Closes underlying client.
|
com.mongodb.client.MongoClient |
getClient()
Returns an instance of
MongoClient . |
String |
getDatabaseName()
Returns the database name hint.
|
List<DataLinkResource> |
listResources()
Lists all MongoDB collections in all databases.
|
static DataLinkConfig |
mongoDataLinkConf(String name,
String connectionString)
Helper method to create new
MongoDataLink with given name and connection string. |
getConfig, getName, release, retain
public static final String CONNECTION_STRING_PROPERTY
public static final String DATABASE_PROPERTY
listResources()
will return only collection from db with this
name, but client is not restricted to this database. It can be used to specify database to which SQL Mappings
will point.public MongoDataLink(DataLinkConfig config)
@Nonnull public com.mongodb.client.MongoClient getClient()
MongoClient
.
If client is shared and there will be still some usages of given client,
the MongoClient.close() method won't take an effect.public String getDatabaseName()
@Nonnull public List<DataLinkResource> listResources()
public void destroy()
@Nonnull public static DataLinkConfig mongoDataLinkConf(String name, String connectionString)
MongoDataLink
with given name and connection string.Copyright © 2023 Hazelcast, Inc.. All rights reserved.