in mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java [968:1010]
public int executeBackendUpdateQuery(final BackendQuery<MongoDBQueryDescriptor> backendQuery, final QueryParameters queryParameters, final TupleContext tupleContext) {
MongoDBQueryDescriptor queryDescriptor = backendQuery.getQuery();
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() ) { // TODO Implement binding positional parameters.
throw new UnsupportedOperationException( "Positional parameters are not yet supported for MongoDB native queries." );
}
switch ( queryDescriptor.getOperation() ) {
case INSERTMANY:
case INSERTONE:
case INSERT:
return doInsert( queryDescriptor, collection );
case REPLACEONE:
return doReplaceOne( queryDescriptor, collection );
case REMOVE:
case DELETEMANY:
case DELETEONE:
return doRemove( queryDescriptor, collection, queryDescriptor.getOperation() );
case UPDATE:
case UPDATEONE:
case UPDATEMANY:
return doUpdate( queryDescriptor, collection, queryDescriptor.getOperation() );
case DROP:
return doDrop( collection );
case FIND:
case FINDONE:
case FINDANDMODIFY:
case AGGREGATE:
case AGGREGATE_PIPELINE:
case COUNT:
case DISTINCT:
throw log.readQueryMustBeExecutedViaGetResultList( queryDescriptor );
default:
throw new IllegalArgumentException( "Unexpected query operation: " + queryDescriptor );
}
}