////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

=== Installation

==== Installation using Grails

To get started with RxGORM for MongoDB in a Grails application simply add the following dependency to your `build.gradle` file:

[source,groovy,subs="attributes"]
.`build.gradle`
----
implementation "org.grails.plugins:rx-mongodb:{version}"
----

==== Installation without Grails

If you are not developing a Grails application then define the following dependency in your `build.gradle` or `pom.xml`:

[source,groovy,subs="attributes"]
.`build.gradle`
----
implementation "org.grails:grails-datastore-gorm-rx-mongodb:{version}"
----

With that done you will need to place the following logic in the bootstrap path of your application:

[source,groovy]
----
import org.grails.datastore.rx.mongodb.*
import com.mongodb.rx.client.MongoClient
...
MongoClient mongoClient = ... // create the MongoClient

new RxMongoDatastoreClient(
            mongoClient, // <1>
            "myDatabase", // <2>
            MyClass // <3>
)
----

<1> The `MongoClient` instance
<2> The name of the default database to save objects to
<3> One or many classes that implement link:../api/grails/gorm/rx/RxEntity.html[RxEntity]

The `org.grails.datastore.rx.mongodb.RxMongoDatastoreClient` class is required to initialize RxGORM for MongoDB.


