String collectionName = null;
DBObject orderBy = null;
// query already given as DBObject (created by JP-QL parser)
if ( customQuery.getSpec() instanceof DBObjectQuerySpecification ) {
DBObjectQuerySpecification spec = (DBObjectQuerySpecification) customQuery.getSpec();
mongodbQuery = spec.getQuery();
projection = spec.getProjection();
collectionName = spec.getCollectionName();
orderBy = spec.getOrderBy();
}
// a string-based native query; need to create the DBObject from that
else {
mongodbQuery = (BasicDBObject) JSON.parse( customQuery.getSQL() );
validate( metadatas );