Skip to content

GPMONGODB-213: only return distinct value when projections property is selected #451

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

Closed
graemerocher opened this issue Jul 18, 2012 · 1 comment

Comments

@graemerocher
Copy link
Contributor

Original Reporter: wdong18
Environment: Not Specified
Version: 1.0.0.RC5
Migrated From: http://jira.grails.org/browse/GPMONGODB-213

Suppose Student domain is like:
[classcode:01,studentcode:0101],
[classcode:01,studentcode:0102],
[classcode:02:studentcode:0201]

and I want to get only classcodes like this:
def c = Student.createCriteria();
def stList = c.list {
projections{
property("classcode")
}
}

and stList.size() is 2 instead of 3.
The result is [10,20], not [10,10,20]

@graemerocher
Copy link
Contributor Author

graemerocher said:
use distinct('classcode') instead of property('classcode')

@graemerocher graemerocher self-assigned this May 27, 2015
jamesfredley pushed a commit that referenced this issue Mar 8, 2025
* Update groovy monorepo to v3.0.11

* Improvements around CompileStatic

In Apache Groovy 3.0.11, the compiler is more strict towards type conversion.

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Puneet Behl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant