Project Polygene has retired. For details please refer to its Attic page.
MongoDB EntityStore
Zest™
Introduction
Tutorials
Javadoc
Samples
Core
Libraries
Extensions
Tools
Glossary 

MongoDB EntityStore

code

docs

tests

EntityStore service backed by a MongoDB collection in which Entity state is stored as native MongoDB BSON.

Table 66. Artifact

Group IDArtifact IDVersion

org.qi4j.extension

org.qi4j.extension.entitystore-mongodb

2.1


Assembly

Assembly is done using the provided Assembler:

public void assemble( ModuleAssembly module )
    throws AssemblyException
{
  [...snip...]

    new MongoMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module );
      [...snip...]

}

Configuration

Here are the configuration properties for the MongoDB EntityStore:

public interface MongoEntityStoreConfiguration
    extends ConfigurationComposite
{

    @Optional
    Property<String> hostname();

    @Optional
    Property<Integer> port();

    @UseDefaults
    Property<List<ServerAddress>> nodes();

    @UseDefaults
    Property<String> username();

    @UseDefaults
    Property<String> password();

    @Optional
    Property<String> database();

    @Optional
    Property<String> collection();

    @UseDefaults
    Property<WriteConcern> writeConcern();

    enum WriteConcern
    {

        /** Exceptions are raised for network issues, but not server errors */
        NORMAL,
        /** Exceptions are raised for network issues, and server errors; waits on a server for the write operation */
        SAFE,
        /** Exceptions are raised for network issues, and server errors; waits on a majority of servers for the write operation */
        MAJORITY,
        /** Exceptions are raised for network issues, and server errors; the write operation waits for the server to flush the data to disk*/
        FSYNC_SAFE,
        /** Exceptions are raised for network issues, and server errors; the write operation waits for the server to group commit to the journal file on disk*/
        JOURNAL_SAFE,
        /** Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operation*/
        REPLICAS_SAFE;

    }

}