use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class DefaultCouchDBDocumentCollectionManagerTest method shouldRemoveEntityByName.
@Test
public void shouldRemoveEntityByName() {
DocumentEntity entity = getEntity();
entity.remove(CouchDBConstant.ID);
entity = entityManager.insert(entity);
Document name = entity.find("name").get();
DocumentQuery query = select().from(COLLECTION_NAME).where(name.getName()).eq(name.get()).build();
DocumentDeleteQuery deleteQuery = delete().from(COLLECTION_NAME).where(name.getName()).eq(name.get()).build();
entityManager.delete(deleteQuery);
assertTrue(entityManager.select(query).collect(Collectors.toList()).isEmpty());
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class MangoQueryConverterTest method shouldSelectFromLtAge.
@ParameterizedTest
@JsonSource("select_from_lt_order.json")
public void shouldSelectFromLtAge(JsonObject expected) {
DocumentQuery query = select().from("person").where("age").lt(10).build();
JsonObject jsonObject = converter.apply(query);
assertEquals(expected, jsonObject);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class MangoQueryConverterTest method shouldReturnSelectFieldsLimitSkip.
@ParameterizedTest
@JsonSource("select_fields_skip_start.json")
public void shouldReturnSelectFieldsLimitSkip(JsonObject expected) {
DocumentQuery query = select("_id", "_rev").from("person").limit(10).skip(2).build();
JsonObject jsonObject = converter.apply(query);
assertEquals(expected, jsonObject);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class MangoQueryConverterTest method shouldReturnSelectFromAllBookmark.
@ParameterizedTest
@JsonSource("select_all.json")
public void shouldReturnSelectFromAllBookmark(JsonObject expected) {
DocumentQuery query = select().from("person").build();
JsonObject jsonObject = converter.apply(CouchDBDocumentQuery.of(query));
assertEquals(expected, jsonObject);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class MangoQueryConverterTest method shouldReturnSelectFromOrder.
@ParameterizedTest
@JsonSource("select_from_order.json")
public void shouldReturnSelectFromOrder(JsonObject expected) {
DocumentQuery query = select().from("person").orderBy("year").asc().orderBy("name").desc().build();
JsonObject jsonObject = converter.apply(query);
assertEquals(expected, jsonObject);
}
Aggregations