Skip to main content

Imports object structures generated by MongoDB object relation mappers (like Mongoose) into Neo4j for exploration with SemSpect

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongo2neo4j-1.0.4.tar.gz (57.8 kB view details)

Uploaded Source

Built Distribution

mongo2neo4j-1.0.4-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file mongo2neo4j-1.0.4.tar.gz.

File metadata

  • Download URL: mongo2neo4j-1.0.4.tar.gz
  • Upload date:
  • Size: 57.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mongo2neo4j-1.0.4.tar.gz
Algorithm Hash digest
SHA256 1c881734920368f63599463096af472b7fe08e8ccdfb574e10072acbe87015c9
MD5 dbb5a2b05dc497bdcb5f216595cb1c1b
BLAKE2b-256 3a481a88b59b8fec79027e5bf7dea23eae084f6a35c466c34a750a2e8f86e397

See more details on using hashes here.

File details

Details for the file mongo2neo4j-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: mongo2neo4j-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mongo2neo4j-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b612b1d797347e15e795d8004e32780d8fd9dd72a6f8bd36d7c465fa266dd352
MD5 b6c3c438201d7005e9dfde8af2e573d0
BLAKE2b-256 5a9f6600432786fc9462d183830971258914ea78cd1ea28f0e336b538dfec34c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page