use of com.cloudant.client.api.query.QueryBuilder in project java-cloudant by cloudant.
the class QueryTests method basicSelector15.
// "$in operator used with full text indexing"
@Test
public void basicSelector15() {
QueryBuilder qb = new QueryBuilder(in("year", 2010, 2015));
Assertions.assertEquals("{\"selector\": {\"year\": {\"$in\": [2010, 2015]}}}", qb.build());
}
use of com.cloudant.client.api.query.QueryBuilder in project java-cloudant by cloudant.
the class QueryTests method basicSelector4.
// "Example selector using an operator to match any document, where the age field has a value
// greater than 20:"
@Test
public void basicSelector4() {
QueryBuilder qb = new QueryBuilder(gt("year", 2018));
Assertions.assertEquals("{\"selector\": {\"year\": {\"$gt\": 2018}}}", qb.build());
}
use of com.cloudant.client.api.query.QueryBuilder in project java-cloudant by cloudant.
the class QueryTests method complexSelector1.
@Test
public void complexSelector1() {
QueryBuilder qb = new QueryBuilder(not(and(gt("year", 2009), nin("year", 2010, 2015))));
Assertions.assertEquals("{\"selector\": {\"$not\": {\"$and\": [{\"year\": {\"$gt\": " + "2009}}, {\"year\": {\"$nin\": [2010, 2015]}}]}}}", qb.build());
}
use of com.cloudant.client.api.query.QueryBuilder in project java-cloudant by cloudant.
the class QueryTests method basicSelector16_single.
// "$nin operator used with full text indexing"
@Test
public void basicSelector16_single() {
QueryBuilder qb = new QueryBuilder(and(gt("year", 2009), nin("year", 2010)));
Assertions.assertEquals("{\"selector\": {\"$and\": [{\"year\": {\"$gt\": 2009}}, " + "{\"year\": {\"$nin\": [2010]}}]}}", qb.build());
}
use of com.cloudant.client.api.query.QueryBuilder in project java-cloudant by cloudant.
the class QueryTests method basicSelector13.
// "$exists operator used with database indexed on the field "year""
@Test
public void basicSelector13() {
QueryBuilder qb = new QueryBuilder(and(eq("year", 2015), exists("title", true)));
Assertions.assertEquals("{\"selector\": {\"$and\": [{\"year\": {\"$eq\": 2015}}, " + "{\"title\": {\"$exists\": true}}]}}", qb.build());
}
Aggregations