Search in sources :

Example 6 with ContainsPic

use of dev.morphia.test.query.TestLegacyQuery.ContainsPic in project morphia by mongodb.

the class TestQueriesOnReferences method testFindByReference.

@Test
public void testFindByReference() {
    final ContainsPic cpk = new ContainsPic();
    final Pic p = new Pic();
    cpk.setPic(p);
    getDs().save(List.of(p, cpk));
    assertNotNull(getDs().find(ContainsPic.class).filter(Filters.eq("pic", p)).first());
}
Also used : ContainsPic(dev.morphia.test.query.TestLegacyQuery.ContainsPic) ContainsPic(dev.morphia.test.query.TestLegacyQuery.ContainsPic) Pic(dev.morphia.test.query.TestLegacyQuery.Pic) Test(org.testng.annotations.Test)

Aggregations

ContainsPic (dev.morphia.test.query.TestLegacyQuery.ContainsPic)6 Pic (dev.morphia.test.query.TestLegacyQuery.Pic)6 Test (org.testng.annotations.Test)6 FindOptions (dev.morphia.query.FindOptions)4 Key (dev.morphia.Key)1 PicWithObjectId (dev.morphia.test.query.TestLegacyQuery.PicWithObjectId)1