Neode - Object Graph Mapper for Node JS

Neode is a Neo4j OGM for Node JS designed to take care of the CRUD boilerplate involved with setting up a neo4j project. The idea is to reduce the amount of code it takes to start a Neo4j project in with node. Just set up your models, create a Neode instance in your project and off you go...

I wrote an article on Medium explaining my inspiration and how to get started.

If you have any problems or have feedback, feel free to reply here or open up an issue. Pull Requests are also more than welcome.

Main Repository:
Example Project:

Happy coding!


Hi @adam.cowley I was wondering if you have any examples of your OGM creating relationships between 2 nodes. I have been trying to see if I can use your OGM to achieve this without having to write a cypher.


1 Like

Hi Ben,

At the moment you would need to do something like the following. It's not ideal but this assumes that you need to load the two nodes.

const person1 = neode.find('Person', id1);
const person2 = neode.find('Person', id2);

person1.relateTo(person2, rel_type, properties)
  .then(rel => console.log(

Or if you don't have the nodes loaded, you could pass through the information into a merge call:

neode.merge('Person', {
  id: 1,
  knows: [ {id: 2} ]

Let me know if that helps.

1 Like

so using knows as the relationship or would we have to explicitly define this in the Model.

module.exports: {
...knows : {

I would definitely be interested in using both methods but at the moment I am just getting to grips to define the relationships. I will let you know how I get on thanks

Knows would need to be defined in both scenarios. What are you trying to do? It would be easier to advise if I know what you're trying to do.

Might as well thanks for the help :) . I am trying to construct a test project, it's a population management system. In the system, you define parent locations and any subsequent child locations defined are nested in their parents. And so on.

I defined the model as

module.exports = {
labels: ["Location"],

name: {
type: 'string',
unique: 'true', // Creates a Unique Constraint

id: {
primary: true,
type: 'uuid',
required: true, // Creates an Exists Constraint in Enterprise mode
malePopulation: {
type: 'number',
femalePopulation: {
type: 'number',
totalPopulation: {
type: 'number',
located_in: {
type: "relationship",
target: "Location",
relationship: "LOCATED",
direction: "in",
properties: {
name: "string"

I am using a Neo4j DB on GrapheneDB. At the moment I have only been able to create the nodes but no relationships. The final aim is to be able to update a child location and for those changes to reflect in the parents e.g. If I had a parent Location called U.S.A with a child New York which also had a child Maine. Updates in Maine and New York would reflect in U.S.A. Thanks for the help

Aren't person1 and person2 Promises? Shouldn't it be:

  (res) => {
    res.relateTo(location2, 'located_in')
      .then(rel => console.log(


Hi @adam.cowley I having issues with neode, please see what I get when I try to create a node

As you can see when I run the create command using a neode instance the promise didn't resolve sucessfuly, I review also the model and connection settings are right, so I don't know what's wrong, Would you help me?

Thanks for submitting!

I’ve added a tag that allows your blog to be displayed on the community home page!

I don't think the function in the router is asynchronous, I'm not sure whether removing async will solve the problem or not.

You can also use res.toJson() to return a cleaner JSON object with its properties rather than using JSON.stringify.

What version of neode are you using? Do you have a repository that I can clone and take a look at?

Hi, I'm having some trouble understanding what I have to do. I have used:

    User: require('./models/User'),
    Skill: require('./models/Skill')

.schema.install().then(() => console.log('schemas installed')))

But my models don't appear in the db until I create a node of that type?

What does .schema.install() actually do? And do I have to do any .model() commands?


Hi Adam.
I'm trying to do a simple find and update but having no success.
Based on combining a couple of your examples I expected to code:

instance.first('Person', 'name', 'Adam')
    .then(adam => adam.update({age: 29}));

But this produces the following error:
ValidationError: child "person_id" fails because ["person_id" is required]

When I check the person object in debug it has an id value.

Any assistance would be most welcome.

Sorry for the delay in replying. This is something that has been bugging me for a while. I published 0.3.4 last night which should fix this issue. Let me know how you get on.

Thanks Adam. However, I've gone back to basics.
I'm just using the raw browser version of the Neo4j Driver which is sufficient for my needs now that I've figured out how it works.
I wish you well with this project.