|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eobjects.metamodel.AbstractDataContext
org.eobjects.metamodel.QueryPostprocessDataContext
org.eobjects.metamodel.mongodb.MongoDbDataContext
public class MongoDbDataContext
DataContext implementation for MongoDB.
Since MongoDB has no schema, a virtual schema will be used in this
DataContext. This implementation supports either automatic discovery of a
schema or manual specification of a schema, through the
MongoDbTableDef class.
| Field Summary |
|---|
| Fields inherited from class org.eobjects.metamodel.QueryPostprocessDataContext |
|---|
INFORMATION_SCHEMA_NAME |
| Constructor Summary | |
|---|---|
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,
MongoDbTableDef... tableDefs)
Deprecated. use MongoDbDataContext(DB, SimpleTableDef...)
instead |
|
MongoDbDataContext(com.mongodb.DB mongoDb,
SimpleTableDef... tableDefs)
Constructs a MongoDbDataContext. |
|
| Method Summary | |
|---|---|
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)
|
DataSet |
executeQuery(Query query)
|
void |
executeUpdate(UpdateScript update)
|
void |
executeUpdate(UpdateScript update,
com.mongodb.WriteConcern writeConcern)
Executes an update with a specific WriteConcern. |
void |
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,
Column[] columns,
int maxRows)
|
protected DataSet |
materializeMainSchemaTable(Table table,
Column[] columns,
int firstRow,
int maxRows)
|
void |
setWriteConcernAdvisor(WriteConcernAdvisor writeConcernAdvisor)
Sets a global WriteConcern advisor to use on
executeUpdate(UpdateScript). |
| Methods inherited from class org.eobjects.metamodel.QueryPostprocessDataContext |
|---|
addConverter, getDefaultSchemaName, getMainSchemaInternal, getSchemaByNameInternal, getSchemaNamesInternal, isMainSchemaTable, materializeFromItem, materializeMainSchemaTable, materializeTable |
| Methods inherited from class org.eobjects.metamodel.AbstractDataContext |
|---|
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, isQualifiedPathDelim, parseQuery, query, refreshSchemas |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eobjects.metamodel.DataContext |
|---|
compileQuery, executeQuery, executeQuery, getColumnByQualifiedLabel, getDefaultSchema, getSchemaByName, getSchemaNames, getSchemas, getTableByQualifiedLabel, parseQuery, query, refreshSchemas |
| Constructor Detail |
|---|
@Deprecated
public MongoDbDataContext(com.mongodb.DB mongoDb,
MongoDbTableDef... tableDefs)
MongoDbDataContext(DB, SimpleTableDef...)
instead
mongoDb - tableDefs -
public MongoDbDataContext(com.mongodb.DB mongoDb,
SimpleTableDef... tableDefs)
MongoDbDataContext. This constructor accepts a
custom array of MongoDbTableDefs which allows the user to define
his own view on the collections in the database.
mongoDb - the mongo db connectiontableDefs - an array of MongoDbTableDefs, 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 connection| Method Detail |
|---|
public 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 inspect
detectTable(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 collection
protected Schema getMainSchema()
throws MetaModelException
getMainSchema in class QueryPostprocessDataContextMetaModelException
protected String getMainSchemaName()
throws MetaModelException
getMainSchemaName in class QueryPostprocessDataContextMetaModelException
protected Number executeCountQuery(Table table,
List<FilterItem> whereItems,
boolean functionApproximationAllowed)
executeCountQuery in class QueryPostprocessDataContextpublic DataSet executeQuery(Query query)
executeQuery in interface DataContextexecuteQuery in class QueryPostprocessDataContext
protected com.mongodb.BasicDBObject createMongoDbQuery(Table table,
List<FilterItem> whereItems)
protected DataSet materializeMainSchemaTable(Table table,
Column[] columns,
int maxRows)
materializeMainSchemaTable in class QueryPostprocessDataContext
protected DataSet materializeMainSchemaTable(Table table,
Column[] columns,
int firstRow,
int maxRows)
materializeMainSchemaTable in class QueryPostprocessDataContext
public void executeUpdate(UpdateScript update,
WriteConcernAdvisor writeConcernAdvisor)
WriteConcernAdvisor.
update - writeConcernAdvisor -
public void executeUpdate(UpdateScript update,
com.mongodb.WriteConcern writeConcern)
WriteConcern.
update - writeConcern - public void 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).
writeConcernAdvisor - public com.mongodb.DB getMongoDb()
DB instance that this DataContext is backed by.
protected void addTable(MutableTable table)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||