Package org.teiid.translator.mongodb
Class MongoDBDirectQueryExecution
- java.lang.Object
-
- org.teiid.translator.mongodb.MongoDBBaseExecution
-
- org.teiid.translator.mongodb.MongoDBDirectQueryExecution
-
- All Implemented Interfaces:
Execution,ProcedureExecution,ResultSetExecution
public class MongoDBDirectQueryExecution extends MongoDBBaseExecution implements ProcedureExecution
This enables the Direct Query execution of the MongoDB queries. For that to happen the procedure invocation needs to be like {code} native('CollectionName;{$match : { \"CompanyName\" : \"A\"}};{$project : {\"CompanyName\", "userName}}', [param1, param2]) {code} the first parameter must be collection name, then the arguments must match the aggregation pipeline structure delimited by semi-colon (;) between each pipeline statement select x.* from TABLE(call native('city;{$match:{"city":"FREEDOM"}}')) t, xmltable('/city' PASSING JSONTOXML('city', cast(array_get(t.tuple, 1) as BLOB)) COLUMNS city string, state string) x select JSONTOXML('city', cast(array_get(t.tuple, 1) as BLOB)) as col from TABLE(call native('city;{$match:{"city":"FREEDOM"}}')) t;
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanreturnsArray-
Fields inherited from class org.teiid.translator.mongodb.MongoDBBaseExecution
connection, executionContext, metadata, mongoDB
-
-
Constructor Summary
Constructors Constructor Description MongoDBDirectQueryExecution(List<Argument> arguments, Command cmd, ExecutionContext executionContext, RuntimeMetadata metadata, MongoDBConnection connection, String nativeQuery, boolean returnsArray, MongoDBExecutionFactory ef)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()voidclose()voidexecute()List<?>getOutputParameterValues()List<?>next()com.mongodb.DBObjectnextRow()
-
-
-
Constructor Detail
-
MongoDBDirectQueryExecution
public MongoDBDirectQueryExecution(List<Argument> arguments, Command cmd, ExecutionContext executionContext, RuntimeMetadata metadata, MongoDBConnection connection, String nativeQuery, boolean returnsArray, MongoDBExecutionFactory ef)
-
-
Method Detail
-
execute
public void execute() throws TranslatorException- Specified by:
executein interfaceExecution- Throws:
TranslatorException
-
getOutputParameterValues
public List<?> getOutputParameterValues() throws TranslatorException
- Specified by:
getOutputParameterValuesin interfaceProcedureExecution- Throws:
TranslatorException
-
next
public List<?> next() throws TranslatorException, DataNotAvailableException
- Specified by:
nextin interfaceResultSetExecution- Throws:
TranslatorExceptionDataNotAvailableException
-
nextRow
public com.mongodb.DBObject nextRow() throws TranslatorException, DataNotAvailableException
-
cancel
public void cancel() throws TranslatorException- Specified by:
cancelin interfaceExecution- Throws:
TranslatorException
-
-