public class MongoDbDataContext extends QueryPostprocessDataContext implements UpdateableDataContext
SimpleTableDef class.INFORMATION_SCHEMA_NAME, SYSTEM_PROPERTY_CREATE_DEFAULT_TABLE_ALIAS| Constructor and Description |
|---|
MongoDbDataContext(com.mongodb.DB mongoDb)
Constructs a
MongoDbDataContext and automatically detects the
schema structure/view on all collections (see detectSchema(DB)). |
MongoDbDataContext(com.mongodb.DB mongoDb,
SimpleTableDef... tableDefs)
Constructs a
MongoDbDataContext. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addTable(MutableTable table) |
protected com.mongodb.BasicDBObject |
createMongoDbQuery(Table table,
List<FilterItem> whereItems) |
static SimpleTableDef[] |
detectSchema(com.mongodb.DB db)
Performs an analysis of the available collections in a Mongo
DB
instance and tries to detect the table's structure based on the first
1000 documents in each collection. |
static SimpleTableDef |
detectTable(com.mongodb.DB db,
String collectionName)
Performs an analysis of an available collection in a Mongo
DB
instance and tries to detect the table structure based on the first 1000
documents in the collection. |
protected Number |
executeCountQuery(Table table,
List<FilterItem> whereItems,
boolean functionApproximationAllowed) |
protected Row |
executePrimaryKeyLookupQuery(Table table,
List<SelectItem> selectItems,
Column primaryKeyColumn,
Object keyValue) |
DataSet |
executeQuery(Query query) |
UpdateSummary |
executeUpdate(UpdateScript update) |
UpdateSummary |
executeUpdate(UpdateScript update,
com.mongodb.WriteConcern writeConcern)
Executes an update with a specific
WriteConcern. |
UpdateSummary |
executeUpdate(UpdateScript update,
WriteConcernAdvisor writeConcernAdvisor)
Executes an update with a specific
WriteConcernAdvisor. |
protected Schema |
getMainSchema() |
protected String |
getMainSchemaName() |
com.mongodb.DB |
getMongoDb()
Gets the
DB instance that this DataContext is backed by. |
WriteConcernAdvisor |
getWriteConcernAdvisor()
Gets the
WriteConcernAdvisor to use on
executeUpdate(UpdateScript) calls. |
protected DataSet |
materializeMainSchemaTable(Table table,
List<Column> columns,
int maxRows) |
protected DataSet |
materializeMainSchemaTable(Table table,
List<Column> columns,
int firstRow,
int maxRows) |
void |
setWriteConcernAdvisor(WriteConcernAdvisor writeConcernAdvisor)
Sets a global
WriteConcern advisor to use on
executeUpdate(UpdateScript). |
addConverter, getDefaultSchemaName, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, isScalarFunctionMaterialized, materializeFromItem, materializeMainSchemaTable, materializeMainSchemaTableSelect, materializeTablecompileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, onSchemaCacheRefreshed, parseQuery, query, refreshSchemasclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemaspublic MongoDbDataContext(com.mongodb.DB mongoDb,
SimpleTableDef... tableDefs)
MongoDbDataContext. This constructor accepts a
custom array of SimpleTableDefs which allows the user to define
his own view on the collections in the database.mongoDb - the mongo db connectiontableDefs - an array of SimpleTableDefs, which define the table
and column model of the mongo db collections. (consider using
detectSchema(DB) or detectTable(DB, String)
).public MongoDbDataContext(com.mongodb.DB mongoDb)
MongoDbDataContext and automatically detects the
schema structure/view on all collections (see detectSchema(DB)).mongoDb - the mongo db connectionpublic static SimpleTableDef[] detectSchema(com.mongodb.DB db)
DB
instance and tries to detect the table's structure based on the first
1000 documents in each collection.db - the mongo db to inspectdetectTable(DB, String)public static SimpleTableDef detectTable(com.mongodb.DB db, String collectionName)
DB
instance and tries to detect the table structure based on the first 1000
documents in the collection.db - the mongo DBcollectionName - the name of the collectionprotected Schema getMainSchema() throws MetaModelException
getMainSchema in class QueryPostprocessDataContextMetaModelExceptionprotected String getMainSchemaName() throws MetaModelException
getMainSchemaName in class QueryPostprocessDataContextMetaModelExceptionprotected Number executeCountQuery(Table table, List<FilterItem> whereItems, boolean functionApproximationAllowed)
executeCountQuery in class QueryPostprocessDataContextprotected Row executePrimaryKeyLookupQuery(Table table, List<SelectItem> selectItems, Column primaryKeyColumn, Object keyValue)
executePrimaryKeyLookupQuery in class QueryPostprocessDataContextpublic DataSet executeQuery(Query query)
executeQuery in interface DataContextexecuteQuery in class QueryPostprocessDataContextprotected com.mongodb.BasicDBObject createMongoDbQuery(Table table, List<FilterItem> whereItems)
protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int maxRows)
materializeMainSchemaTable in class QueryPostprocessDataContextprotected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int firstRow, int maxRows)
materializeMainSchemaTable in class QueryPostprocessDataContextpublic UpdateSummary executeUpdate(UpdateScript update, WriteConcernAdvisor writeConcernAdvisor)
WriteConcernAdvisor.public UpdateSummary executeUpdate(UpdateScript update, com.mongodb.WriteConcern writeConcern)
WriteConcern.public UpdateSummary executeUpdate(UpdateScript update)
executeUpdate in interface UpdateableDataContextpublic WriteConcernAdvisor getWriteConcernAdvisor()
WriteConcernAdvisor to use on
executeUpdate(UpdateScript) calls.public void setWriteConcernAdvisor(WriteConcernAdvisor writeConcernAdvisor)
WriteConcern advisor to use on
executeUpdate(UpdateScript).public com.mongodb.DB getMongoDb()
DB instance that this DataContext is backed by.protected void addTable(MutableTable table)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.