Source:
<code>public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<MongoDBQueryDescriptor> backendQuery, QueryParameters queryParameters, TupleContext tupleContext) { MongoDBQueryDescriptor queryDescriptor = backendQuery.getQuery(); if ( backendQuery.getSingleEntityMetadataInformationOrNull() != null && queryDescriptor.getProjection() != null ) { <START> throw log.addEntityNotAllowedInNativeQueriesUsingProjection(); <END> } EntityKeyMetadata entityKeyMetadata = backendQuery.getSingleEntityMetadataInformationOrNull() == null ? null : backendQuery.getSingleEntityMetadataInformationOrNull().getEntityKeyMetadata(); String collectionName = getCollectionName( backendQuery, queryDescriptor, entityKeyMetadata ); MongoCollection<Document> collection = provider.getDatabase().getCollection( collectionName ); if ( !queryParameters.getPositionalParameters().isEmpty() ) { throw new UnsupportedOperationException( "Positional parameters are not yet supported for MongoDB native queries." ); } switch ( queryDescriptor.getOperation() ) { case FIND: return doFind( queryDescriptor, queryParameters, collection, entityKeyMetadata ); case FINDONE: return doFindOne( queryDescriptor, collection, entityKeyMetadata ); case FINDANDMODIFY: return doFindAndModify( queryDescriptor, collection, entityKeyMetadata ); case AGGREGATE: return doAggregate( queryDescriptor, queryParameters, collection, entityKeyMetadata ); case AGGREGATE_PIPELINE: return doAggregatePipeline( queryDescriptor, queryParameters, collection, entityKeyMetadata ); case COUNT: return doCount( queryDescriptor, collection ); case DISTINCT: return doDistinct( queryDescriptor, collection ); case MAP_REDUCE: return doMapReduce( queryDescriptor, collection ); case INSERT: case INSERTONE: case INSERTMANY: case REMOVE: case DELETEMANY: case DELETEONE: case UPDATE: case UPDATEONE: case UPDATEMANY: case REPLACEONE: throw log.updateQueryMustBeExecutedViaExecuteUpdate( queryDescriptor ); default: throw new IllegalArgumentException( "Unexpected query operation: " + queryDescriptor ); } }</code><technical_language>Is this MongoDB specific? Otherwise, nice add in core if possible. in Neo4j</technical_language>

Target:
public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<MongoDBQueryDescriptor> backendQuery, QueryParameters queryParameters, TupleContext tupleContext) { MongoDBQueryDescriptor queryDescriptor = backendQuery.getQuery(); EntityKeyMetadata entityKeyMetadata = ( backendQuery.getSingleEntityMetadataInformationOrNull() == null ) ? null : backendQuery.getSingleEntityMetadataInformationOrNull().getEntityKeyMetadata(); if ( entityKeyMetadata != null && queryDescriptor.getProjection() != null ) { throw log.addEntityNotAllowedInNativeQueriesUsingProjection( entityKeyMetadata.getTable() ); } String collectionName = getCollectionName( backendQuery, queryDescriptor, entityKeyMetadata ); MongoCollection<Document> collection = provider.getDatabase().getCollection( collectionName ); if ( !queryParameters.getPositionalParameters().isEmpty() ) { throw new UnsupportedOperationException( "Positional parameters are not yet supported for MongoDB native queries." ); } switch ( queryDescriptor.getOperation() ) { case FIND: return doFind( queryDescriptor, queryParameters, collection, entityKeyMetadata ); case FINDONE: return doFindOne( queryDescriptor, collection, entityKeyMetadata ); case FINDANDMODIFY: return doFindAndModify( queryDescriptor, collection, entityKeyMetadata ); case AGGREGATE: return doAggregate( queryDescriptor, queryParameters, collection, entityKeyMetadata ); case AGGREGATE_PIPELINE: return doAggregatePipeline( queryDescriptor, queryParameters, collection, entityKeyMetadata ); case COUNT: return doCount( queryDescriptor, collection ); case DISTINCT: return doDistinct( queryDescriptor, collection ); case MAP_REDUCE: return doMapReduce( queryDescriptor, collection ); case INSERT: case INSERTONE: case INSERTMANY: case REMOVE: case DELETEMANY: case DELETEONE: case UPDATE: case UPDATEONE: case UPDATEMANY: case REPLACEONE: throw log.updateQueryMustBeExecutedViaExecuteUpdate( queryDescriptor ); default: throw new IllegalArgumentException( "Unexpected query operation: " + queryDescriptor ); } }