This page describes an older version of the product. The latest stable version is 16.4.

Data Source

A MongoDB based implementation of the Space Data Source.

Library dependencies

The MongoDB Space Data Source uses MongoDB Driver For communicating with the MongoDB cluster.

include the following in your pom.xml

<!-- currently the MongoDB library is not the central maven repository --> 

            <name>Allanbank Releases</name>

<!-- mongodb java driver -->




An example of how the MongoDB Space Data Source can be configured for a space that loads data back from MongoDB once initialized and also asynchronously persists the data using a mirror (see MongoDB Space Synchronization Endpoint)).


With XAP 9.7.1 version please use the code example provided in version 10.0

<?xml version="1.0" encoding="utf-8"?> 
<beans xmlns="" 
xmlns:xsi="" xmlns:context="" 
xmlns:os-core="" xmlns:os-jms="" 
xmlns:os-sla="" xmlns:tx="" 

xsi:schemaLocation=" 9.7/core/openspaces-core.xsd 9.7/events/openspaces-events.xsd 9.7/remoting/openspaces-remoting.xsd">

<bean id="propertiesConfigurer" 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" /> 

<os-core:space id="space" url="/./dataSourceSpace"
    space-data-source="spaceDataSource" mirrored="true" schema="persistent">
            <!-- Use ALL IN CACHE, put 0 for LRU --> 
            <prop key="space-config.engine.cache_policy">1</prop>               
            <prop key="cluster-config.cache-loader.central-data-source">true</prop>
            <prop key="cluster-config.mirror-service.supports-partial-update">true</prop>

<os-core:giga-space id="gigaSpace" space="space" /> 

<bean id="mongoClient"
        <property name="db" value="${mongo.db}" />
        <property name="config">
            <bean class="com.allanbank.mongodb.MongoClientConfiguration">
                <constructor-arg value="mongodb://${}:${mongo.port}/${mongo.db}"
                    type="java.lang.String" />
                <property name="defaultDurability" value="ACK"/>        

<bean id="spaceDataSource" 
        <property name="mongoClientConnector" ref="mongoClient" />


MongoClientConfiguration config = new MongoClientConfiguration();


MongoClientConnector client = new MongoClientConnectorConfigurer()

MongoSpaceDataSource spaceDataSource = new MongoSpaceDataSourceConfigurer()

GigaSpace gigaSpace = new GigaSpaceConfigurer(new UrlSpaceConfigurer("/./space")    
.cachePolicy(new LruCachePolicy()) 
.addProperty("cluster-config.cache-loader.central-data-source", "true") 
.addProperty("cluster-config.mirror-service.supports-partial-update", "true") 

For more details about different configurations see Space Persistency.

Before you begin

Before deploying your Processing Unit, please do the following:

  1. Copy the mongo-datasource.jar from lib\optional\datasource\mongo to lib\optional\pu-common.
  2. download the following jars and copy them to lib\optional\pu-common:

MongoSpaceDataSource Properties

Property Description Default
mongoClientConnector A configured com.gigaspaces.persistency.MongoClientConnector bean. Must be configured


General limitations

  • All classes that belong to types that are to be introduced to the space during the initial metadata load must exist on the classpath of the JVM the Space is running on.

Cache miss Query limitations

Supported queries:

  • id = 1234

  • name = 'John' AND age = 13

  • address.streetName = 'Liberty'

  • age > 15

  • age < 20

  • age <= 20

  • age >= 15

  • name = 'John' OR name = 'Jane'

  • name rlike 'A.*B'

  • name like 'A%'

  • name is NULL

  • name is NOT NULL

note: java types Short, Float, BigDecimal and BigInt supported only =,<> queries >,<,>=,<= is not supported.

Unsupported queries: Unsupported queries: - Contains is unsupported