public class QueryConverter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
D_AGGREGATION_ALLOW_DISK_USE |
static String |
D_AGGREGATION_BATCH_SIZE |
| Constructor and Description |
|---|
QueryConverter(InputStream inputStream)
Create a QueryConverter with a string
|
QueryConverter(InputStream inputStream,
Map<String,FieldType> fieldNameToFieldTypeMapping,
FieldType defaultFieldType)
Create a QueryConverter with an InputStream
|
QueryConverter(String sql)
Create a QueryConverter with a string
|
QueryConverter(String sql,
FieldType fieldType)
Create a QueryConverter with a string
|
QueryConverter(String sql,
Map<String,FieldType> fieldNameToFieldTypeMapping)
Create a QueryConverter with a string
|
QueryConverter(String sql,
Map<String,FieldType> fieldNameToFieldTypeMapping,
FieldType defaultFieldType)
Create a QueryConverter with a string
|
| Modifier and Type | Method and Description |
|---|---|
MongoDBQueryHolder |
getMongoQuery()
get the object that you need to submit a query
|
<T> T |
run(com.mongodb.client.MongoDatabase mongoDatabase) |
void |
write(OutputStream outputStream)
Build a mongo shell statement with the code to run the specified query.
|
public static final String D_AGGREGATION_ALLOW_DISK_USE
public static final String D_AGGREGATION_BATCH_SIZE
public QueryConverter(String sql) throws ParseException
sql - the sql statementParseException - when the sql query cannot be parsedpublic QueryConverter(String sql, Map<String,FieldType> fieldNameToFieldTypeMapping) throws ParseException
sql - the sql statementfieldNameToFieldTypeMapping - mapping for each fieldParseException - when the sql query cannot be parsedpublic QueryConverter(String sql, FieldType fieldType) throws ParseException
sql - sql stringfieldType - the default FieldType to be usedParseExceptionpublic QueryConverter(String sql, Map<String,FieldType> fieldNameToFieldTypeMapping, FieldType defaultFieldType) throws ParseException
sql - sql stringfieldNameToFieldTypeMapping - mapping for each fielddefaultFieldType - defaultFieldType the default FieldType to be usedParseExceptionpublic QueryConverter(InputStream inputStream) throws ParseException
inputStream - an input stream that has the sql statement in itParseException - when the sql query cannot be parsedpublic QueryConverter(InputStream inputStream, Map<String,FieldType> fieldNameToFieldTypeMapping, FieldType defaultFieldType) throws ParseException
inputStream - an input stream that has the sql statement in itfieldNameToFieldTypeMapping - mapping for each fielddefaultFieldType - the default FieldType to be usedParseException - when the sql query cannot be parsedpublic MongoDBQueryHolder getMongoQuery()
MongoDBQueryHolder
that contains all that is needed to describe the query to be run.public void write(OutputStream outputStream) throws IOException
outputStream - the OutputStream to write the data toIOException - when there is an issue writing to the OutputStreampublic <T> T run(com.mongodb.client.MongoDatabase mongoDatabase)
T - variable based on the type of query run.mongoDatabase - the database to run the query against.Document>
When query does a count will return a Long
When query does a distinct will return QueryResultIterator<String>Copyright © 2018. All rights reserved.