@@ -74,7 +74,7 @@ public class DocumentValidation {
|
||||
@Test
|
||||
public void criteriaValidator() {
|
||||
|
||||
Validator validator = Validator.criteria( //
|
||||
var validator = Validator.criteria( //
|
||||
where("name").exists(true).ne(null).type(2) // non null String
|
||||
.and("age").exists(true).ne(null).type(16).gte(0).lte(125)) // non null int between 0 and 125
|
||||
;
|
||||
@@ -116,7 +116,7 @@ public class DocumentValidation {
|
||||
@Test
|
||||
public void schemaValidator() {
|
||||
|
||||
Validator validator = Validator.schema(MongoJsonSchema.builder() //
|
||||
var validator = Validator.schema(MongoJsonSchema.builder() //
|
||||
.required("name", "age") //
|
||||
.properties( //
|
||||
string("name").minLength(1), //
|
||||
|
||||
@@ -75,13 +75,13 @@ public class SchemaQuery {
|
||||
@Test
|
||||
public void criteriaValidator() {
|
||||
|
||||
Jedi luke = new Jedi("luke", "luke", "skywalker", 25);
|
||||
Jedi yoda = new Jedi("yoda", "yoda", null, 900);
|
||||
var luke = new Jedi("luke", "luke", "skywalker", 25);
|
||||
var yoda = new Jedi("yoda", "yoda", null, 900);
|
||||
|
||||
mongoOps.save(luke);
|
||||
mongoOps.save(yoda);
|
||||
|
||||
MongoJsonSchema schema = MongoJsonSchema.builder() //
|
||||
var schema = MongoJsonSchema.builder() //
|
||||
.required("name", "age") //
|
||||
.properties( //
|
||||
string("name").minLength(1), //
|
||||
|
||||
Reference in New Issue
Block a user