Skip to content

Commit 4c2e8ff

Browse files
committed
Update documentation
- Correct the doc manual and java api links - Add release notes
1 parent f58d2d6 commit 4c2e8ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+221
-195
lines changed

src/docs/guide/gettingStarted.adoc

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,26 @@
1-
=== Basic Setup
1+
== Basic Setup
22

33
To get started with GORM for MongoDB within Grails you need configure it as a dependency in `build.gradle`:
44

55
[source,groovy,subs="attributes"]
66
----
77
dependencies {
8-
compile 'org.grails.plugins:mongodb:{pluginVersion}'
8+
implementation 'org.graceframework.plugins:mongodb:{version}'
99
}
1010
----
1111

12-
=== Common Errors
13-
14-
If you receive an error that indicates a failure to resolve the `grails-datastore-simple` dependency you may need to add the following to `build.gradle` directly above the `dependencies` block:
15-
16-
[source,groovy]
17-
.build.gradle
18-
----
19-
configurations.all {
20-
exclude module:'grails-datastore-simple'
21-
}
22-
----
23-
24-
If you receive an error at runtime such as:
25-
26-
[source,groovy]
27-
----
28-
Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class org.bson.BsonDecimal128.
29-
at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46)
30-
at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63)
31-
at org.bson.codecs.configuration.ChildCodecRegistry.get(ChildCodecRegistry.java:51)
32-
at org.bson.codecs.BsonTypeCodecMap.<init>(BsonTypeCodecMap.java:44)
33-
at org.bson.codecs.BsonDocumentCodec.<init>(BsonDocumentCodec.java:65)
34-
----
35-
36-
It means you have an older version of the MongoDB Java driver on your classpath and you should add the following declaration to `build.gradle` to ensure the dependency is correct:
37-
38-
[source,groovy,subs="attributes"]
39-
.build.gradle
40-
----
41-
compile "org.mongodb:mongodb-driver:{mongoDriverVersion}"
42-
----
43-
44-
=== Configuring MongoDB
12+
== Configuring MongoDB
4513

4614
With that done you need to set up a running MongoDB server. Refer to the https://docs.mongodb.com/getting-started/shell/[MongoDB Documentation] for an explanation on how to startup a MongoDB instance. Once installed, starting MongoDB is typically a matter of executing the following command:
4715

48-
[source,groovy]
16+
[source,console]
4917
----
5018
MONGO_HOME/bin/mongod
5119
----
5220

5321
With the above command executed in a terminal window you should see output like the following appear:
5422

55-
[source,groovy]
23+
[source,console]
5624
----
5725
2015-11-18T19:38:50.073+0100 I JOURNAL <<initandlisten>> journal dir=/data/db/journal
5826
2015-11-18T19:38:50.073+0100 I JOURNAL <<initandlisten>> recover : no journal files present, no recovery needed
@@ -71,9 +39,9 @@ With the above command executed in a terminal window you should see output like
7139
2015-11-18T19:38:50.176+0100 I NETWORK <<initandlisten>> waiting for connections on port 27017
7240
----
7341

74-
As you can see the server is running on port 27017, but don't worry the MongoDB plugin for Grails will automatically configure itself to look for MongoDB on that port by default.
42+
As you can see the server is running on port 27017, but don't worry the MongoDB plugin for Grace framework will automatically configure itself to look for MongoDB on that port by default.
7543

76-
If you want to configure how Grails connects to MongoDB then you can do so using the following settings in `grails-app/conf/application.yml`:
44+
If you want to configure how Grace framework connects to MongoDB then you can do so using the following settings in `app/conf/application.yml`:
7745

7846
[source,groovy]
7947
----

src/docs/guide/gettingStarted/advancedConfig.adoc

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
=== Mongo Database Connection Configuration
12

2-
==== Mongo Database Connection Configuration
3-
4-
5-
As mentioned the GORM for MongoDB plugin will configure all the defaults for you, but if you wish to customize those defaults you can do so in the `grails-app/conf/application.groovy` file:
3+
As mentioned the GORM for MongoDB plugin will configure all the defaults for you, but if you wish to customize those defaults you can do so in the `app/conf/application.groovy` file:
64

75
[source,groovy]
86
----
@@ -33,12 +31,11 @@ grails {
3331
}
3432
----
3533

36-
Available options and their descriptions are defined in the https://api.mongodb.org/java/current/com/mongodb/MongoClientOptions.html[MongoClientOptions] javadoc.
37-
38-
==== MongoDB Connection Strings
34+
Available options and their descriptions are defined in the https://mongodb.github.io/mongo-java-driver/5.0/apidocs/mongodb-driver-legacy/com/mongodb/MongoClientOptions.html[MongoClientOptions] javadoc.
3935

36+
=== MongoDB Connection Strings
4037

41-
Since 2.0, you can also use MongoDB https://docs.mongodb.org/manual/reference/connection-string/[connection strings] to configure the connection:
38+
Since 2.0, you can also use MongoDB https://www.mongodb.com/docs/manual/reference/connection-string/[connection strings] to configure the connection:
4239

4340
[source,groovy]
4441
----
@@ -51,10 +48,7 @@ grails {
5148

5249
Using MongoDB connection strings is currently the most flexible and recommended way to configure MongoDB connections.
5350

54-
55-
56-
==== Configuration Options Guide
57-
51+
=== Configuration Options Guide
5852

5953
Below is a complete example showing all configuration options:
6054

@@ -87,12 +81,9 @@ grails {
8781
}
8882
----
8983

84+
=== Global Mapping Configuration
9085

91-
92-
==== Global Mapping Configuration
93-
94-
95-
Using the `grails.mongodb.default.mapping` setting in `grails-app/conf/application.groovy` you can configure global mapping options across your domain classes. This is useful if, for example, you want to disable optimistic locking globally or you wish to use `DBRefs` in your association mappings. For example, the following configuration will disable optimistic locking globally and use `DBRefs` for all properties:
86+
Using the `grails.mongodb.default.mapping` setting in `app/conf/application.groovy` you can configure global mapping options across your domain classes. This is useful if, for example, you want to disable optimistic locking globally or you wish to use `DBRefs` in your association mappings. For example, the following configuration will disable optimistic locking globally and use `DBRefs` for all properties:
9687

9788
[source,groovy]
9889
----

src/docs/guide/gettingStarted/mongoOnly.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ If you plan to use MongoDB as your primary datastore then you need to remove the
22

33
[source,groovy]
44
----
5-
compile 'org.grails.plugins:hibernate'
5+
implementation 'org.graceframework.plugins:hibernate'
66
----
77

8-
With this done all domain classes in grails-app/domain will be persisted via MongoDB and not Hibernate. You can create a domain class by running the regular `create-domain-class` command:
8+
With this done all domain classes in `app/domain` will be persisted via MongoDB and not Hibernate. You can create a domain class by running the regular `create-domain-class` command:
99

10-
[source,groovy]
10+
[source,console]
1111
----
12-
grails create-domain-class Person
12+
$ grace create-domain-class Person
1313
----
1414

1515
The `Person` domain class will automatically be a persistent entity that can be stored in MongoDB.

src/docs/guide/gettingStarted/outsideGrails.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
If you wish to use GORM for MongoDB outside of a Grails application you should declare the necessary dependencies, for example in Gradle:
1+
If you wish to use GORM for MongoDB outside of a Grace application you should declare the necessary dependencies, for example in Gradle:
22

33
[source,groovy,subs="attributes"]
44
----
5-
compile "org.grails:grails-datastore-gorm-mongodb:{version}"
5+
implementation "org.graceframework:grace-boot:{version}"
6+
implementation "org.graceframework.plugins:mongodb:{version}"
67
----
78

89
Then annotate your entities with the `grails.gorm.annotation.Entity` annotation:

src/docs/guide/gettingStarted/springBoot.adoc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,27 @@ To use GORM for MongoDB in Spring Boot add the necessary dependencies to your Bo
22

33
[source,groovy,subs="attributes"]
44
----
5-
compile("org.grails:gorm-mongodb-spring-boot:{version}")
5+
implementation "org.graceframework:grace-boot:{version}"
6+
implementation "org.graceframework.plugins:mongodb:{version}"
67
----
78

8-
Ensure your Boot `Application` class is annotated with `ComponentScan`, example:
9+
Ensure your Boot `Application` class is annotated with `GrailsComponentScan`, example:
910

1011
[source,groovy]
1112
----
1213
import org.springframework.boot.SpringApplication
13-
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
14-
import org.springframework.context.annotation.*
14+
import org.springframework.boot.autoconfigure.SpringBootApplication
1515
16-
@Configuration
17-
@EnableAutoConfiguration
18-
@ComponentScan
16+
@SpringBootApplication
1917
class Application {
2018
static void main(String[] args) {
2119
SpringApplication.run Application, args
2220
}
2321
}
2422
----
2523

26-
NOTE: Using `ComponentScan` without a value results in Boot scanning for classes in the same package or any package nested within the `Application` class package.
27-
If your GORM entities are in a different package specify the package name as the value of the `ComponentScan` annotation.
24+
NOTE: Using `GrailsComponentScan` without a value results in Boot scanning for classes in the same package or any package nested within the `Application` class package.
25+
If your GORM entities are in a different package specify the package name as the value of the `GrailsComponentScan` annotation.
2826

2927
Finally create your GORM entities and ensure they are annotated with `grails.persistence.Entity`:
3028

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
If you have both the Hibernate and Mongo plugins installed then by default all classes in the `grails-app/domain` directory will be persisted by Hibernate and not Mongo. If you want to persist a particular domain class with Mongo then you must use the `mapWith` property in the domain class:
1+
If you have both the Hibernate and Mongo plugins installed then by default all classes in the `app/domain` directory will be persisted by Hibernate and not Mongo. If you want to persist a particular domain class with Mongo then you must use the `mapWith` property in the domain class:
22

33
[source,groovy]
44
----
55
static mapWith = "mongo"
66
----
7-
8-
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
There is a plugin available that will execute an in memory Mongo database during your integration tests. Data will be cleared between test cases so they can work similarly to H2 with `@Rollback`.
2-
3-
Visit the github page of the link:https://github.com/grails-plugins/grails-embedded-mongodb[Embedded MongoDB Grails Plugin] to learn more.

src/docs/guide/introduction/compatibility.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This implementation tries to be as compatible as possible with GORM for Hibernate. In general you can refer to the https://grails.org/doc/latest/guide/5.%20Object%20Relational%20Mapping%20(GORM).html[GORM documentation] and the "Domain Classes" section of the https://grails.org/doc/latest/[reference guide] (see the right nav) for usage information.
1+
This implementation tries to be as compatible as possible with GORM for Hibernate. In general you can refer to the https://graceframework.org/grace-data/2023.3.x/[GORM documentation] for usage information.
22

33
The following key features are supported by GORM for Mongo:
44

src/docs/guide/introduction/upgradeNotes.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
==== Dependency Upgrades
22

3-
GORM 7.1 supports Apache Groovy 3, Java 14, MongoDB Driver 4.3 and Spring 5.3.x.
3+
GORM 2023.3 supports Apache Groovy 4.0, Java 17, MongoDB Driver 5.0 and Spring 6.1.x.
44

55
Each of these underlying components may have changes that require altering your application. These changes are beyond the scope of this documentation.
66

77
==== Default Autowire By Type inside GORM Data Services
88

9-
A Grails Service (or a bean) inside GORM DataService will default to autowire by-type, For example:
9+
A GORM Service (or a bean) inside GORM DataService will default to autowire by-type, For example:
1010

11-
_./grails-app/services/example/BookService.groovy_
11+
_./app/services/example/BookService.groovy_
1212
```
1313
package example
1414

@@ -27,5 +27,4 @@ abstract class BookService {
2727
}
2828
```
2929

30-
Please note that with autowire by-type as the default, when multiple beans for same type are found the application with throw Exception. Use the Spring `@Qualifier annotation for https://docs.spring.io/spring-framework/docs/5.3.10/reference/html/core.html#beans-autowired-annotation-qualifiers[Fine-tuning Annotation Based Autowiring with Qualifiers].
31-
30+
Please note that with autowire by-type as the default, when multiple beans for same type are found the application with throw Exception. Use the Spring `@Qualifier annotation for link:{springrefdoc}/core/beans/annotation-config/autowired-qualifiers.html[Fine-tuning Annotation Based Autowiring with Qualifiers].

src/docs/guide/lowLevelApi.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
A lower level API is provided by the plugin via the MongoDB driver
22

3-
NOTE: There is an excellent tutorial on how to use the MongoDB Java driver's API directly in the https://mongodb.github.io/mongo-java-driver/3.1/driver/getting-started/quick-tour/[MongoDB documentation]
3+
NOTE: There is an excellent tutorial on how to use the MongoDB Java driver's API directly in the https://mongodb.github.io/mongo-java-driver/5.0/driver/getting-started/quick-start/[MongoDB documentation]
44

55
An example can be seen below:
66

0 commit comments

Comments
 (0)