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

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

Comments

@spring-projects-issues
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());
}

Thanks


Affects: 1.5.4 (Dijkstra SR4)

Referenced from: pull request #223

Backported to: 1.5.5 (Dijkstra SR5)

@spring-projects-issues
Copy link
Author

Christoph Strobl commented

good catch - thanks!

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

No branches or pull requests

2 participants