Thi is a MongoDB Data Importer for Solr.
- import data from MongoDB to solr
- support full import and delta import
- support for transform from MongoDB's ObjectID to Long
- mongo-java-driver
- support config items
- host (default: localhost)
- port (default: 27017)
- database
- username (optional)
- password (optional)
<dataConfig>
<dataSource name="mongod" type="MongoDataSource" host="127.0.0.1" port="27017" database="example" />
</dataConfig>
- support config items
- collection
- command
- deltaCommand (optional, if not set, and request a delta import, we will use command instead)
<entity processor="MongoDBEntityProcessor" dataSource="mongod" name="test" collection="coll" command="{}">
<field column="_id" name="docId"/>
<field column="title" name="title"/>
<!-- other fileds -->
</entity>
Somethime we need a Long docId, but we have ObjectId in MongoDB, so a transformer may help.
This transfomer just cover the ObjectId to it's hashcode :-)
<entity processor="MongoDBEntityProcessor" dataSource="mongod" name="test" collection="coll" command="{}">
<field column="_id" name="docId" hashObjectId="true"/> <!-- docId has long type-->
<field column="title" name="title"/>
<!-- other fileds -->
</entity>
<dataConfig>
<dataSource name="mongod" type="MongoDataSource" host="127.0.0.1" port="27017" database="example" />
<entity processor="MongoDBEntityProcessor" dataSource="mongod" name="test" collection="coll" command="{}">
<field column="_id" name="docId" hashObjectId="true"/> <!-- docId has long type-->
<field column="title" name="title"/>
<!-- other fileds -->
</entity>
</dataConfig>