Skip to content

Commit eb03ae6

Browse files
christophstroblodrotbohm
authored andcommitted
DATAMONGO-856 - Documentation updates.
Updated references from springsource.org to spring.io. Updated references to mongodb.org. Update vendor to Pivotal Software, Inc. Update required/recommended versions. Update CustomConversions configuration section. Added missing section id's. Fixed some typos. Added missing JavaDoc. Original pull request: spring-projects#128.
1 parent 5be66a3 commit eb03ae6

File tree

24 files changed

+393
-131
lines changed

24 files changed

+393
-131
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Spring Data MongoDB
22

3-
The primary goal of the [Spring Data](http://www.springsource.org/spring-data) project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
3+
The primary goal of the [Spring Data](http://projects.spring.io/spring-data) project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
44

55
The Spring Data MongoDB project aims to provide a familiar and consistent Spring-based programming model for new datastores while retaining store-specific features and capabilities. The Spring Data MongoDB project provides integration with the MongoDB document database. Key functional areas of Spring Data MongoDB are a POJO centric model for interacting with a MongoDB DBCollection and easily writing a repository style data access layer.
66

77
## Getting Help
88

99
For a comprehensive treatment of all the Spring Data MongoDB features, please refer to:
1010

11-
* the [User Guide](http://static.springsource.org/spring-data/data-mongodb/docs/current/reference/html/)
12-
* the [JavaDocs](http://static.springsource.org/spring-data/data-mongodb/docs/current/api/) have extensive comments in them as well.
13-
* the home page of [Spring Data MongoDB](http://www.springsource.org/spring-data/mongodb) contains links to articles and other resources.
14-
* for more detailed questions, use the [forum](http://forum.springsource.org/forumdisplay.php?f=80).
11+
* the [User Guide](http://docs.spring.io/spring-data/mongodb/docs/current/reference/html/)
12+
* the [JavaDocs](http://docs.spring.io/spring-data/mongodb/docs/current/api/) have extensive comments in them as well.
13+
* the home page of [Spring Data MongoDB](http://projects.spring.io/spring-data-mongodb) contains links to articles and other resources.
14+
* for more detailed questions, use the [forum](http://forum.spring.io/forum/spring-projects/data/nosql).
1515

16-
If you are new to Spring as well as to Spring Data, look for information about [Spring projects](http://www.springsource.org/projects).
16+
If you are new to Spring as well as to Spring Data, look for information about [Spring projects](http://projects.spring.io/).
1717

1818

1919
## Quick Start
@@ -53,7 +53,7 @@ MongoTemplate is the central support class for Mongo database operations. It pro
5353
* Basic POJO mapping support to and from BSON
5454
* Convenience methods to interact with the store (insert object, update objects) and MongoDB specific ones (geo-spatial operations, upserts, map-reduce etc.)
5555
* Connection affinity callback
56-
* Exception translation into Spring's [technology agnostic DAO exception hierarchy](http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/dao.html#dao-exceptions).
56+
* Exception translation into Spring's [technology agnostic DAO exception hierarchy](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/dao.html#dao-exceptions).
5757

5858
### Spring Data repositories
5959

@@ -139,9 +139,9 @@ public class MyService {
139139

140140
Here are some ways for you to get involved in the community:
141141

142-
* Get involved with the Spring community on the Spring Community Forums. Please help out on the [forum](http://forum.springsource.org/forumdisplay.php?f=80) by responding to questions and joining the debate.
142+
* Get involved with the Spring community on the Spring Community Forums. Please help out on the [forum](http://forum.spring.io/forum/spring-projects/data/nosql) by responding to questions and joining the debate.
143143
* Create [JIRA](https://jira.springframework.org/browse/DATADOC) tickets for bugs and new features and comment and vote on the ones that you are interested in.
144144
* Github is for social coding: if you want to write code, we encourage contributions through pull requests from [forks of this repository](http://help.github.com/forking/). If you want to contribute code this way, please reference a JIRA ticket as well covering the specific issue you are addressing.
145-
* Watch for upcoming articles on Spring by [subscribing](http://www.springsource.org/node/feed) to springframework.org
145+
* Watch for upcoming articles on Spring by [subscribing](http://spring.io/blog) to spring.io.
146146

147147
Before we accept a non-trivial patch or pull request we will need you to sign the [contributor's agreement](https://support.springsource.com/spring_committer_signup). Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<name>Spring Data MongoDB</name>
1212
<description>MongoDB support for Spring Data</description>
13-
<url>http://www.springsource.org/spring-data/mongodb</url>
13+
<url>http://projects.spring.io/spring-data-mongodb</url>
1414

1515
<parent>
1616
<groupId>org.springframework.data.build</groupId>

spring-data-mongodb-cross-store/template.mf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Bundle-SymbolicName: org.springframework.data.mongodb.crossstore
22
Bundle-Name: Spring Data MongoDB Cross Store Support
3-
Bundle-Vendor: SpringSource
3+
Bundle-Vendor: Pivotal Software, Inc.
44
Bundle-ManifestVersion: 2
55
Import-Package:
66
sun.reflect;version="0";resolution:=optional

spring-data-mongodb-log4j/template.mf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Bundle-SymbolicName: org.springframework.data.mongodb.log4j
22
Bundle-Name: Spring Data Mongo DB Log4J Appender
3-
Bundle-Vendor: SpringSource
3+
Bundle-Vendor: Pivotal Software, Inc.
44
Bundle-ManifestVersion: 2
55
Import-Package:
66
sun.reflect;version="0";resolution:=optional

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoDocumentWriter.java

-20
This file was deleted.

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java

+87-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright 2010-2013 the original author or authors.
3-
*
2+
* Copyright 2011-2014 the original author or authors.
3+
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
@@ -468,10 +468,32 @@ <T> MapReduceResults<T> mapReduce(Query query, String inputCollectionName, Strin
468468
*/
469469
<T> T findOne(Query query, Class<T> entityClass, String collectionName);
470470

471+
/**
472+
* Determine result of given {@link Query} contains at least one element.
473+
*
474+
* @param query the {@link Query} class that specifies the criteria used to find a record.
475+
* @param collectionName name of the collection to check for objects.
476+
* @return
477+
*/
471478
boolean exists(Query query, String collectionName);
472479

480+
/**
481+
* Determine result of given {@link Query} contains at least one element.
482+
*
483+
* @param query the {@link Query} class that specifies the criteria used to find a record.
484+
* @param entityClass the parameterized type.
485+
* @return
486+
*/
473487
boolean exists(Query query, Class<?> entityClass);
474488

489+
/**
490+
* Determine result of given {@link Query} contains at least one element.
491+
*
492+
* @param query the {@link Query} class that specifies the criteria used to find a record.
493+
* @param entityClass the parameterized type.
494+
* @param collectionName name of the collection to check for objects.
495+
* @return
496+
*/
475497
boolean exists(Query query, Class<?> entityClass, String collectionName);
476498

477499
/**
@@ -529,12 +551,58 @@ <T> MapReduceResults<T> mapReduce(Query query, String inputCollectionName, Strin
529551
*/
530552
<T> T findById(Object id, Class<T> entityClass, String collectionName);
531553

554+
/**
555+
* Triggers <a href="http://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify<a/>
556+
* to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query}.
557+
*
558+
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
559+
* fields specification.
560+
* @param update the {@link Update} to apply on matching documents.
561+
* @param entityClass the parameterized type.
562+
* @return
563+
*/
532564
<T> T findAndModify(Query query, Update update, Class<T> entityClass);
533565

566+
/**
567+
* Triggers <a href="http://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify<a/>
568+
* to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query}.
569+
*
570+
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
571+
* fields specification.
572+
* @param update the {@link Update} to apply on matching documents.
573+
* @param entityClass the parameterized type.
574+
* @param collectionName the collection to query.
575+
* @return
576+
*/
534577
<T> T findAndModify(Query query, Update update, Class<T> entityClass, String collectionName);
535578

579+
/**
580+
* Triggers <a href="http://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify<a/>
581+
* to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query} taking
582+
* {@link FindAndModifyOptions} into account.
583+
*
584+
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
585+
* fields specification.
586+
* @param update the {@link Update} to apply on matching documents.
587+
* @param options the {@link FindAndModifyOptions} holding additional information.
588+
* @param entityClass the parameterized type.
589+
* @return
590+
*/
536591
<T> T findAndModify(Query query, Update update, FindAndModifyOptions options, Class<T> entityClass);
537592

593+
/**
594+
* Triggers <a href="http://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/">findAndModify<a/>
595+
* to apply provided {@link Update} on documents matching {@link Criteria} of given {@link Query} taking
596+
* {@link FindAndModifyOptions} into account.
597+
*
598+
* @param query the {@link Query} class that specifies the {@link Criteria} used to find a record and also an optional
599+
* fields specification.
600+
* @param update the {@link Update} to apply on matching documents.
601+
* @param options the {@link FindAndModifyOptions} holding additional information.
602+
* @param entityClass the parameterized type.
603+
* @param collectionName the collection to query.
604+
* @return
605+
*/
538606
<T> T findAndModify(Query query, Update update, FindAndModifyOptions options, Class<T> entityClass,
539607
String collectionName);
540608

@@ -598,9 +666,9 @@ <T> T findAndModify(Query query, Update update, FindAndModifyOptions options, Cl
598666
* <p/>
599667
* If you object has an "Id' property, it will be set with the generated Id from MongoDB. If your Id property is a
600668
* String then MongoDB ObjectId will be used to populate that string. Otherwise, the conversion from ObjectId to your
601-
* property type will be handled by Spring's BeanWrapper class that leverages Spring 3.0's new Type Conversion API.
602-
* See <a href="http://static.springsource.org/spring/docs/3.0.x/reference/validation.html#core-convert">Spring 3 Type
603-
* Conversion"</a> for more details.
669+
* property type will be handled by Spring's BeanWrapper class that leverages Type Conversion API. See <a
670+
* href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert"
671+
* >Spring's Type Conversion"</a> for more details.
604672
* <p/>
605673
* <p/>
606674
* Insert is used to initially store the object into the database. To update an existing object use the save method.
@@ -655,9 +723,9 @@ <T> T findAndModify(Query query, Update update, FindAndModifyOptions options, Cl
655723
* <p/>
656724
* If you object has an "Id' property, it will be set with the generated Id from MongoDB. If your Id property is a
657725
* String then MongoDB ObjectId will be used to populate that string. Otherwise, the conversion from ObjectId to your
658-
* property type will be handled by Spring's BeanWrapper class that leverages Spring 3.0's new Type Conversion API.
659-
* See <a href="http://static.springsource.org/spring/docs/3.0.x/reference/validation.html#core-convert">Spring 3 Type
660-
* Conversion"</a> for more details.
726+
* property type will be handled by Spring's BeanWrapper class that leverages Type Conversion API. See <a
727+
* href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert"
728+
* >Spring's Type Conversion"</a> for more details.
661729
*
662730
* @param objectToSave the object to store in the collection
663731
*/
@@ -672,9 +740,9 @@ <T> T findAndModify(Query query, Update update, FindAndModifyOptions options, Cl
672740
* <p/>
673741
* If you object has an "Id' property, it will be set with the generated Id from MongoDB. If your Id property is a
674742
* String then MongoDB ObjectId will be used to populate that string. Otherwise, the conversion from ObjectId to your
675-
* property type will be handled by Spring's BeanWrapper class that leverages Spring 3.0's new Type Cobnversion API.
676-
* See <a href="http://static.springsource.org/spring/docs/3.0.x/reference/validation.html#core-convert">Spring 3 Type
677-
* Conversion"</a> for more details.
743+
* property type will be handled by Spring's BeanWrapper class that leverages Type Cobnversion API. See <a
744+
* http://docs.spring.io/spring/docs/current/spring-framework-reference/html/validation.html#core-convert">Spring's
745+
* Type Conversion"</a> for more details.
678746
*
679747
* @param objectToSave the object to store in the collection
680748
* @param collectionName name of the collection to store the object in
@@ -814,6 +882,14 @@ <T> T findAndModify(Query query, Update update, FindAndModifyOptions options, Cl
814882
*/
815883
void remove(Query query, Class<?> entityClass);
816884

885+
/**
886+
* Remove all documents that match the provided query document criteria from the the collection used to store the
887+
* entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query.
888+
*
889+
* @param query
890+
* @param entityClass
891+
* @param collectionName
892+
*/
817893
void remove(Query query, Class<?> entityClass, String collectionName);
818894

819895
/**

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoSynchronization.java

+18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
/*
2+
* Copyright 2012-2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.springframework.data.mongodb.core;
217

318
import org.springframework.transaction.support.ResourceHolder;
419
import org.springframework.transaction.support.ResourceHolderSynchronization;
520

21+
/**
22+
* @author Oliver Gierke
23+
*/
624
class MongoSynchronization extends ResourceHolderSynchronization<ResourceHolder, Object> {
725

826
public MongoSynchronization(ResourceHolder resourceHolder, Object resourceKey) {

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/CompoundIndex.java

+14
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,24 @@
5151
@Deprecated
5252
IndexDirection direction() default IndexDirection.ASCENDING;
5353

54+
/**
55+
* @see http://docs.mongodb.org/manual/core/index-unique/
56+
* @return
57+
*/
5458
boolean unique() default false;
5559

60+
/**
61+
* If set to true index will skip over any document that is missing the indexed field.
62+
*
63+
* @see http://docs.mongodb.org/manual/core/index-sparse/
64+
* @return
65+
*/
5666
boolean sparse() default false;
5767

68+
/**
69+
* @see http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping
70+
* @return
71+
*/
5872
boolean dropDups() default false;
5973

6074
/**

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Index.java

+18-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ public enum Duplicates {
4141

4242
private boolean sparse = false;
4343

44-
public Index() {
45-
}
44+
public Index() {}
4645

4746
public Index(String key, Direction direction) {
4847
fieldSpec.put(key, direction);
@@ -83,16 +82,33 @@ public Index named(String name) {
8382
return this;
8483
}
8584

85+
/**
86+
* Reject all documents that contain a duplicate value for the indexed field.
87+
*
88+
* @see http://docs.mongodb.org/manual/core/index-unique/
89+
* @return
90+
*/
8691
public Index unique() {
8792
this.unique = true;
8893
return this;
8994
}
9095

96+
/**
97+
* Skip over any document that is missing the indexed field.
98+
*
99+
* @see http://docs.mongodb.org/manual/core/index-sparse/
100+
* @return
101+
*/
91102
public Index sparse() {
92103
this.sparse = true;
93104
return this;
94105
}
95106

107+
/**
108+
* @see http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping
109+
* @param duplicates
110+
* @return
111+
*/
96112
public Index unique(Duplicates duplicates) {
97113
if (duplicates == Duplicates.DROP) {
98114
this.dropDuplicates = true;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Indexed.java

+26
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,42 @@
3232
@Retention(RetentionPolicy.RUNTIME)
3333
public @interface Indexed {
3434

35+
/**
36+
* If set to true reject all documents that contain a duplicate value for the indexed field.
37+
*
38+
* @see http://docs.mongodb.org/manual/core/index-unique/
39+
* @return
40+
*/
3541
boolean unique() default false;
3642

3743
IndexDirection direction() default IndexDirection.ASCENDING;
3844

45+
/**
46+
* If set to true index will skip over any document that is missing the indexed field.
47+
*
48+
* @see http://docs.mongodb.org/manual/core/index-sparse/
49+
* @return
50+
*/
3951
boolean sparse() default false;
4052

53+
/**
54+
* @see http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping
55+
* @return
56+
*/
4157
boolean dropDups() default false;
4258

59+
/**
60+
* Index name.
61+
*
62+
* @return
63+
*/
4364
String name() default "";
4465

66+
/**
67+
* Colleciton name for index to be created on.
68+
*
69+
* @return
70+
*/
4571
String collection() default "";
4672

4773
/**

0 commit comments

Comments
 (0)