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

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Aug 28, 2014

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

@spring-projects-issues spring-projects-issues commented Sep 4, 2014

Christoph Strobl commented

good catch - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants