Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleteAll repository query don't use EntityMetadata collection name [DATAMONGO-1040] #1963

spring-projects-issues opened this issue Aug 28, 2014 · 1 comment
in: repository Repositories abstraction type: bug A general bug


Copy link

Youness opened DATAMONGO-1040 and commented

Unlike other methods, deleteAll repository queries don't use the collection name provided by MongoEntityMetadata. This prevents me to use multiple collection names for a same Entity.

In AbstractMongoQuery$AbstractMongoQuery :

		private Object deleteAndConvertResult(Query query, MongoEntityMetadata<?> metadata) {

			if (method.isCollectionQuery()) {
				return operations.findAllAndRemove(query, metadata.getJavaType());

			WriteResult writeResult = operations.remove(query, metadata.getJavaType(), metadata.getCollectionName());
			return writeResult != null ? writeResult.getN() : 0L;

A simple change will fix that :

if (method.isCollectionQuery()) {
     return operations.findAllAndRemove(query, metadata.getJavaType(), metadata.getCollectionName());


Affects: 1.5.4 (Dijkstra SR4)

Referenced from: pull request #223

Backported to: 1.5.5 (Dijkstra SR5)

Copy link

Christoph Strobl commented

good catch - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: repository Repositories abstraction type: bug A general bug
None yet

No branches or pull requests

2 participants