Skip to main content

mongo2neo4j

MongoDB Mongoose to Neo4j Importer

License Pylint Ruff Mypy pytest coverage

What is mongo2neo4j?

Imports object relations generated by Object Relation Mappers (ORMs) like Mongoose and stored in MongoDB into the graph database management system Neo4j for exploration with the no-code graphical querying tool SemSpect. Further relations between objects can be specified via options.

What for?

Imagine you just released your latest MEAN-stack app and want to learn how it is used. You could write some MongoDB queries to find out "how many users of the free tier are at all producing some data?", "which feature is used most by subscribers?", ... But maybe you never find time to write those queries or you do not know exact what to look for. A graphical large-data exploration tool like SemSpect comes in handy, which allows you to discover patterns in your data by simple navigation.

As SemSpect is layered on top of the graph database system Neo4j as graph app, your MongoDB data needs first to be established in Neo4j. This can be easily achieved using the mongo2neo4j tool.

How does it work?

The mongodb2neo4j script creates a label (class of nodes) in Neo4j for each collection in the given MongoDB and adds nodes in Neo4j for all documents. Cross-references between MongoDB documents using unique ObjectId identifiers are turned into Neo4j relations, nicely rendered by SemSpect.

Installation

Install Neo4j

The free Neo4j Desktop works well (see Neo4j)

Install SemSpect Plugin

The free SemSpect Graph App for Neo4j works well (see SemSpect)

Install mongo2neo4j

Note: mongo2neo4j requires Python 3.11 or newer.

% pip3 install mongo2neo4j

Run the importer

You can run the mongo2neo4jimporter from the shell by providing at least the name of the MongoDB DB the data should be imported from. If not specified the default neo4j DB is targeted with the default neo4j user. It is likely that you will have to add passwords.

% mongo2neo4j \
  [--mongo_host mongodb://<mongo_user>:<mongo_password>@<mongo_host>] \
  [--neo4j_user=<neo4j_user>] [--neo4j_password=<neo4j_password>] \
  <mongo_db>

Further configuration options are listed on calling

% mongo2neo4j -h

See Script Arguments for the full list of available arguments and the example documenting the workflow of mongo2neo4j using randomly generated sample data.

NOTE: if the APOC plugin is installed in the Neo4j DB, the faster and memory-effective apoc.periodic.iterate method is used to generate nodes and sublabels.

Metadata

Release files for mongo2neo4j 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongo2neo4j 1.0.4
File Size Uploaded
mongo2neo4j-1.0.4.tar.gz 57.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mongo2neo4j 1.0.4
File Interpreter ABI Platform
mongo2neo4j-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 98.7 kB

Release files / mongo2neo4j-1.0.4.tar.gz

Download URL mongo2neo4j-1.0.4.tar.gz
Size 57.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1c881734920368f63599463096af472b7fe08e8ccdfb574e10072acbe87015c9
BLAKE2b-256 checksum
How to use checksums
3a481a88b59b8fec79027e5bf7dea23eae084f6a35c466c34a750a2e8f86e397
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / mongo2neo4j-1.0.4-py3-none-any.whl

Download URL mongo2neo4j-1.0.4-py3-none-any.whl
Size 40.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b612b1d797347e15e795d8004e32780d8fd9dd72a6f8bd36d7c465fa266dd352
BLAKE2b-256 checksum
How to use checksums
5a9f6600432786fc9462d183830971258914ea78cd1ea28f0e336b538dfec34c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page