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

elemMatch with Query produces a validation warning #1288

Closed
kkamkou opened this issue Nov 15, 2018 · 1 comment
Closed

elemMatch with Query produces a validation warning #1288

kkamkou opened this issue Nov 15, 2018 · 1 comment

Comments

@kkamkou
Copy link

kkamkou commented Nov 15, 2018

(v1.3.2)

models:

@Entity(value = "x", noClassnameStored = true)
public class X {
  //...
  @Embedded
  private List<CustomEntityRelation> entities;
  // ...
@Embedded
public final class CustomEntityRelation {
  private ObjectId id;
  private String role;
  private String type;

  public ObjectId getId() {
    return this.id;
  }

  public String getRole() {
    return this.role;
  }

  public String getType() {
    return this.type;
  }
}

Query:

this.ds.createQuery(X.class)
  .field("entities").elemMatch(
    this.ds.createQuery(CustomEntityRelation.class)
      .field("id").equal(new ObjectId())
      .field("role").equal("the boss")
  )

Warning:

org.mongodb.morphia.query.QueryValidator: Validation warnings: 
[Validation failed: 'Type java.util.List may not be queryable with value '{ query: { "id" : { "$oid" : "54eb2e82b5f1e032241c5bd7" }, "role" : "the boss" }  }' with class org.mongodb.morphia.query.QueryImpl', Validation failed: 'Type x.CustomEntityRelation may not be queryable with value '{ query: { "id" : { "$oid" : "54eb2e82b5f1e032241c5bd7" }, "role" : "the boss" }  }' with class org.mongodb.morphia.query.QueryImpl']
@evanchooly
Copy link
Member

Apologies for the delay. I can't recreate this on master. What version are you using? If you can try the 1.5.0-SNAPSHOT build can confirm if this issue still exists, I can take another look at it. But it would seem that issue was resolved elsewhere.

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

2 participants