MongoDB Specific Features

Devender Yadav edited this page May 25, 2015 · 1 revision
Clone this wiki locally

Servers List

You would normally define servers to connect to in "kundera.nodes" property under persistence.xml. However, if you have MongoDB servers running on multiple nodes and possibly different ports, This property comes to your rescue. Just specify this in MongoDB XML configuration file (See XML at bottom)

Read Preference

MongoDB lets you choose whether you want to read data from primary or secondary server. You can specify this behaviour in the following way into MongoDB XML configuration file. (See XML at bottom). Possible values are "primary" and "secondary".

Socket Timeout

You can configure socket timeout (in millisecond) for time period in MongoDB XML configuration file, kundera will wait for connection to MongoDB before timing out. (See XML at bottom)

A sample XML configuration file is given below:

<?xml version="1.0" encoding="UTF-8"?>
	            <property name="read.preference" value="primary"></property>
		    <property name="socket.timeout" value="100000"></property>

For a detailed list of property settings available with MongoDb (supported by Kundera ) please refer to :

<<< Back to Datastore Specific Configuration