public class Jongoby extends Object implements Jooby.Module
Exposes Jongo instances to a default database. Or JongoFactory to use custom or
alternative databases.
Please note, this module depends on: Mongodb module.
{
use(new Mongodb());
use(new Jongoby());
get("/", req -> {
Jongo jongo = req.require(Jongo.class);
// work with jongo...
});
}
Previous example will give you a Jongo instance connected to the default database,
provided by the Mongodb module.
Access to alternate database is provided via: JongoFactory.
{
use(new Mongodb());
use(new Jongoby());
get("/", req -> {
Jongo jongo = req.require(JongoFactory.class).get("alternate-db");
// work with jongo...
});
}
| Constructor and Description |
|---|
Jongoby()
Creates a new
Jongoby module and use the default mapper. |
Jongoby(org.jongo.marshall.jackson.JacksonMapper.Builder mapper)
Creates a new
Jongoby module and use the given Mapper. |
Jongoby(org.jongo.Mapper mapper)
Creates a new
Jongoby module and use the given Mapper. |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Env env,
com.typesafe.config.Config config,
com.google.inject.Binder binder) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconfigpublic Jongoby(org.jongo.Mapper mapper)
Jongoby module and use the given Mapper.mapper - Mapper to use.public Jongoby(org.jongo.marshall.jackson.JacksonMapper.Builder mapper)
Jongoby module and use the given Mapper.mapper - Mapper to use.public Jongoby()
Jongoby module and use the default mapper.public void configure(Env env, com.typesafe.config.Config config, com.google.inject.Binder binder)
configure in interface Jooby.ModuleCopyright © 2016. All rights reserved.