Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MongoDB and Neo4j together

I am starting a new project and I am looking at using MongoDB as the document storage facility and Neo4j as the mechanism to map relationships between documents and then I want to expose the results of my queries via rest API. What would one say are the advantages and disadvantages of doing it this manner? Are there any better ways of achieving this perhaps using a different NoSQL document store? Are there any examples one could find online where someone has tried to do something similar?

like image 808
Mike Barnes Avatar asked Feb 27 '13 14:02

Mike Barnes


People also ask

Is MongoDB good for graph database?

This makes graph databases incredibly efficient for looking for patterns, making predictions, and finding solutions. While it's a general purpose document database, MongoDB provides graph and tree traversal capabilities with its $graphLookup stage in the aggregation pipeline.

What is difference between MongoDB and Neo4j?

Key differences Both Neo4j and MongoDB are NoSQL databases. However, Neo4J is a graph database (Membrey, Hows, & Plugge, 2014). MongoDB is schemaless and provides holistic view of the data with eventual consistency with update information-in-place principle (Membrey, Hows, & Plugge, 2014).

What are the weaknesses of Neo4j?

Neo4j has some upper bound limit for the graph size and can support tens of billions of nodes, properties, and relationships in a single graph. No security is provided at the data level and there is no data encryption. Security auditing is not available in Neo4j.


2 Answers

I have been thinking about using these two together for a while because my data is already in mongodb. But I don't want to add one more DB top of the existing architecture, because addition of neo4j will require more resources e.g. memory, diskspace and not to mention time invested in maintaining 2 DBs.

Another problem which I can think of is when you shard your data with mongodb, you'll also have to manage your neo4j data w.r.t. these new shards. Scaling in neo4j is done through clusters and it is a part of enterprise edition which is commercial.

I did further research and found out that OrientDB can store the data as documents and its a graph db.

Another way is building the relationships in MongoDB itself and write your logic on top of that and expose this logic through a REST API.

like image 177
vikasing Avatar answered Oct 08 '22 19:10

vikasing


You might be interested in the Neo4j Doc Manager for Mongo Connector. It's an extension to the Mongo Connector project that allows for real time one way synchronization of data from MongoDB to Neo4j. Documents inserted in MongoDB are converted to a property graph and automatically inserted into Neo4j. The collection and fields to be synched from Mongo to Neo4j can be configured.

The idea here is to facilitate using Neo4j and MongoDB together in a single application without having to write code in the application layer to sync data.

like image 28
William Lyon Avatar answered Oct 08 '22 19:10

William Lyon