use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class ArangoDBDocumentCollectionManagerTest method shouldRemoveEntity2.
@Test
public void shouldRemoveEntity2() {
DocumentEntity documentEntity = entityManager.insert(getEntity());
Document id = documentEntity.find("name").get();
DocumentQuery select = select().from(COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
DocumentDeleteQuery deleteQuery = delete().from(COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
entityManager.delete(deleteQuery);
assertTrue(entityManager.select(select).collect(Collectors.toList()).isEmpty());
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class ArangoDBDocumentCollectionManagerTest method shouldReadFromDifferentBaseDocumentUsingInstance.
@Test
public void shouldReadFromDifferentBaseDocumentUsingInstance() {
entityManager.insert(getEntity());
ArangoDB arangoDB = DefaultArangoDBDocumentCollectionManager.class.cast(entityManager).getArangoDB();
arangoDB.db(DATABASE).collection(COLLECTION_NAME).insertDocument(new Person());
DocumentQuery select = select().from(COLLECTION_NAME).build();
List<DocumentEntity> entities = entityManager.select(select).collect(Collectors.toList());
assertFalse(entities.isEmpty());
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class QueryAQLConverterTest method shouldRunEqualsQuerySort2.
@Test
public void shouldRunEqualsQuerySort2() {
DocumentQuery query = select().from("collection").where("name").eq("value").orderBy("name").asc().orderBy("age").desc().build();
AQLQueryResult convert = QueryAQLConverter.select(query);
String aql = convert.getQuery();
Map<String, Object> values = convert.getValues();
assertEquals("value", values.get("name"));
assertEquals("FOR c IN collection FILTER c.name == @name SORT c.name ASC , c.age DESC RETURN c", aql);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class QueryAQLConverterTest method shouldRunEqualsQuerySort.
@Test
public void shouldRunEqualsQuerySort() {
DocumentQuery query = select().from("collection").where("name").eq("value").orderBy("name").asc().build();
AQLQueryResult convert = QueryAQLConverter.select(query);
String aql = convert.getQuery();
Map<String, Object> values = convert.getValues();
assertEquals("value", values.get("name"));
assertEquals("FOR c IN collection FILTER c.name == @name SORT c.name ASC RETURN c", aql);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class QueryAQLConverterTest method shouldRunEqualsQueryLimit2.
@Test
public void shouldRunEqualsQueryLimit2() {
DocumentQuery query = select().from("collection").where("name").eq("value").skip(1).limit(5).build();
AQLQueryResult convert = QueryAQLConverter.select(query);
String aql = convert.getQuery();
Map<String, Object> values = convert.getValues();
assertEquals("value", values.get("name"));
assertEquals("FOR c IN collection FILTER c.name == @name LIMIT 1, 5 RETURN c", aql);
}
Aggregations