Question

I am trying to load the data from mongodb database from the Gremlin shell in neo4j in order to create a graph databse from it. The detail is explained in gremlin-mongodb. To get started, I downloaded the GMongo jar file fom GMongo and ran the following codes in Gremlin shell in Neo4j web admin console

gremlin> import com.gmongo.GMongo
gremlin> mongo = new GMongo()    

The import command works and imports the packages but the second line failed with message being undefined. I also tried to import the following packages but that did not work either.

import com.mongodb.BasicDBObject
import com.mongodb.DBObject 

Any idea what the problem is?

Was it helpful?

Solution

Just wanted to highlight the answer that stephen mallette provided for this question and also many thanks to tim_yates and most of Marko Rodrigez. we need to copy both the GMongo jar file from Gmongo as well as Mongo java driver and put them under lib directory. Thanks again Stephen.

OTHER TIPS

Make sure you have GMongo in the lib directory of Gremlin.

Try putting your script in a file and then executing the entire file. For some reason in the shell the context gets lost. If you do an import and then execute another line, the shell won't remember the import.

This is what I end up doing - creating a file and then doing something like this:

./gremlin.sh -e my-script.groovy

Try that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top