This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # HTTP URLs that Could Not Be Fixed These URLs were unable to be fixed. Please review them to see if they can be manually resolved. * http://mybatis.org/dtd/mybatis-3-config.dtd (301) with 1 occurrences could not be migrated: ([https](https://mybatis.org/dtd/mybatis-3-config.dtd) result SSLHandshakeException). * http://mybatis.org/dtd/mybatis-3-mapper.dtd (301) with 2 occurrences could not be migrated: ([https](https://mybatis.org/dtd/mybatis-3-mapper.dtd) result SSLHandshakeException). # Fixed URLs ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * http://maven.apache.org/xsd/maven-4.0.0.xsd with 70 occurrences migrated to: https://maven.apache.org/xsd/maven-4.0.0.xsd ([https](https://maven.apache.org/xsd/maven-4.0.0.xsd) result 200). * http://maven.apache.org/maven-v4_0_0.xsd with 6 occurrences migrated to: https://maven.apache.org/maven-v4_0_0.xsd ([https](https://maven.apache.org/maven-v4_0_0.xsd) result 301). * http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd with 1 occurrences migrated to: https://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ([https](https://java.sun.com/xml/ns/persistence/persistence_2_0.xsd) result 302). # Ignored These URLs were intentionally ignored. * http://java.sun.com/xml/ns/persistence with 2 occurrences * http://maven.apache.org/POM/4.0.0 with 152 occurrences * http://www.w3.org/2001/XMLSchema-instance with 77 occurrences Original pull request: #472
Spring Data MongoDB 2.1 - Schema & Validation Example
MongoDB (as of version 3.2) supports validating documents against a given structure described by a query.
{
"name" : {
"$exists" : true,
"$ne" : null,
"$type" : 2
},
"age" : {
"$exists" : true,
"$ne" : null,
"$type" : 16,
"$gte" : 0,
"$lte" : 125
}
}
The structure can be built from Criteria objects in the same way as they are used for defining queries.
Validator.criteria(where("name").exists(true).ne(null).type(2)
.and("age").exists(true).ne(null).type(16).gte(0).lte(125));
MongoDB 3.6 supports collections that validate documents against a provided JSON Schema that complies with the JSON schema specification (draft 4).
{
"type": "object",
"required": [ "name", "age" ],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"age": {
"type": "int",
"minimum" : 0,
"exclusiveMinimum" : false,
"maximum" : 125,
"exclusiveMaximum" : false
}
}
}
The MongoJsonSchema and its builder allow fluent schema definition via the Java API.
MongoJsonSchema schema = MongoJsonSchema.builder() //
.required("name", "age") //
.properties( //
string("name").minLength(1), //
int32("age").gte(0).lte(125) //
).build();
The schema can be used for various funcitionality: Set up Document validation for a collection:
template.createCollection(Jedi.class, CollectionOptions.empty().validator(Validator.schema(schema)));
and to query the store for documents matching a given blueprint:
template.find(query(matchingDocumentStructure(schema)), Jedi.class);