Giter Club home page Giter Club logo

mongo4j's Introduction

Mongo4J

Build Coverage Status npm npm

A mongoose plugin to automatically maintain nodes in neo4j

Table of contents

Motivation - Why Mongo4J, another library?

The usage of mongo4j is found in the term polyglot persistence. In this case, you will most likely want to combine the 'relationship-navigation' of neo4j while still maintaining documents in MongoDB for quick access and saving all information. Unfortunately, this also brings in extra maintenance to keep both databases in-sync. For this matter, several plugins and programs have been written, under which moneo, neo4j-doc-manager & neomongoose.

These are great solutions, but I've found myself not fully satisfied by these. The doc manager, for example, needs another application layer to install and run it. The other two solutions were either out of date or needed a manual form of maintaining the graphs in neo4j. That's why I decided to give my own ideas a shot in the form of a mongoose plugin.

Mongo4J automatically updates, removes and adds graphs according to the given schema configuration. In addition to this, it adds extra functions to access the graphs from the models through mongoose. This way, there is no need to keep two different approaches to the neo4j-database.

Installation

Download and install the package with npm:

npm install --save mongo4j

Setup

Before you use (require) mongo4j anywhere, First initialize it with drivers.

This creates the singleton pattern lifecycle of driver(s) stated by the neo4j-driver library.

Same options can be used as the official driver and there is the possibility of initializing multiple drivers in the beginning. Which should be only one driver per neo4j database. Options can be found on the neo4j driver documentation.

Single driver

mongo4j.init(host, auth, options)

  • host - Url to neo4j database. Defaults to neo4j://127.0.0.1
  • auth - Authentication parameters:
    • user - User for neo4j authentication. Defaults to neo4j
    • pass - Password for neo4j authentication. Defaults to neo4j
  • options - Options for neo4j driver. These can be found in the documentation.
const mongo4j = require('mongo4j');

mongo4j.init('neo4j://localhost', {user: 'neo4j', pass: 'neo4j'});

Multiple drivers

mongo4j.init(hosts, auth, options)

  • hosts - Array of hosts. A host in this case consists of:
    • name - Identifier to reference this specific driver. (Must be a string) Required
    • url - Url to neo4j database. Defaults to neo4j://127.0.0.1
    • auth - Authentication parameters:
      • user - User for neo4j authentication. Defaults to neo4j
      • pass - Password for neo4j authentication. Defaults to neo4j
    • options - Options for neo4j driver. These can be found in the documentation.
  • auth - Authentication parameters. Will be overwritten by individual authentication set in hosts:
    • user - User for neo4j authentication. Defaults to neo4j
    • pass - Password for neo4j authentication. Defaults to neo4j
  • options - Options for neo4j driver. These can be found in the documentation. Will be overwritten by individual options set in hosts

In the case of multiple drivers make sure you initialize every driver with an identifier (name) in string format for later re-use, otherwise, an error will be thrown.

const mongo4j = require('mongo4j');

mongo4j.init(
  [{
    name: 'testconnection1',
    url: 'neo4j://127.0.0.1',
    auth: {
      user: 'neo4j',
      pass: 'neo4j'
    }
  }, {
    name: 'testconnection2',
    url: 'neo4j://127.0.0.1'
  }]
);

Authentication can be specified as a second argument to use the same authentication for all drivers. Authentication set per host will override these global authentication settings.

The same goes for options. If you only want to use shared options, make sure you pass null as a second argument:

const mongo4j = require('mongo4j');

// connectionPoolSize is set for both drivers
mongo4j.init([host1, host2], null, {connectionPoolSize: 100});

Add the plugin to the schema

CustomSchema.plugin(moneo.plugin(identifier))

  • identifier - Identifier to reference the specific driver to use (in case of multiple drivers).
// Use the default driver connection (in case of one driver)
PersonSchema.plugin(mongo4j.plugin());

// Use the 'testconnection1' driver to connect to neo4j
PersonSchema.plugin(mongo4j.plugin('testconnection1'))

Driver management

These functions will help manage the drivers for neo4j.

mongo4j.getDriver(identifier)

  • identifier - Identifier to reference the specific driver. Can also be an integer. Required in case of multiple drivers

Returns: a driver. In the case of multiple drivers. It will return an Object like:

{
  name: 'testconnection1', // Identifier
  driver: //Neo4JDriver
}
// Get driver in case of only one
mongo4j.getDriver();

// Get testconnection1 driver in case of multiple
mongo4j.getDriver('testconnection1');

// Get testconnection1 driver in case of multiple with integer identifier
// NOTE: identifier = index + 1
mongo4j.getDriver(1);

mongo4j.close(identifier)

  • identifier - Identifier to reference the specific driver. Can also be an integer or true to close all drivers at once. Required in case of multiple drivers

Returns: a single Promise (also in case of multiple drivers).

// Close driver in case of only one
mongo4j.close();

// Close testconnection1 driver in case of multiple
mongo4j.close('testconnection1');

// Close testconnection1 driver in case of multiple with integer identifier
// NOTE: identifier = index + 1
mongo4j.close(1);

// Close all drivers in case of multiple
mongo4j.close(true);

mongo4j.reset()

Returns: a single Promise (also in case of multiple drivers).

// Close all drivers and set drivers to undefined in mongo4j context
mongo4j.reset();

Schema configuration options

After you have added mongo4j as a plugin to your document schema there are several properties to configure which and how data of the document is saved in neo4j.

Standard Properties

These options apply to simple schema properties.

neo_prop: Boolean

  • Defaults to false.
  • If set to true this property will be saved in neo4j.
  • Note: the _id property in MongoDB will automatically be added as m_id in neo4j.
// Save firstName as a property in neo4j
const PersonSchema = new Schema({
  firstName: {
    type: String,
    neo_prop: true
  }
});

Relationships (References, Nested References & Subdocuments)

References, nested references & subdocuments are automatically saved as different nodes as explained here. Therefore there are several options to configure how to relationship is saved.

neo_rel_name: String

  • Defaults to [PROPERTY NAME]_[DOCUMENT TYPE]_[RELATED DOCUMENT TYPE]. ie: SUPERVISOR_CLASS_PERSON
  • Note: relationships will be converted to uppercase to conform to the neo4j naming conventions.
// Results in 'TAUGHT_BY' relationship
const ClassSchema = new Schema({
  teacher: {
    type: mongoose.Schema.ObjectId,
    ref: 'Person',
    neo_rel_name: "Taught By"
  }
});

// NOTE: CLASS refers to class mongo model, not an actual Javascript class.
// Results in 'SUPERVISOR_CLASS_PERSON' relationship (including a start_date property)
const ClassSchema = new Schema({
  supervisor: {
    person: {
      type: mongoose.Schema.ObjectId,
      ref: 'Person'
    },
    start_date: Date
  },
});

neo_omit_rel: Boolean

  • Defaults to false.
  • If set to true this relationship will not be saved (omitted) in neo4j.
// Don't save the relationship to teacher in neo4j (the teacher can still be saved separately)
const ClassSchema = new Schema({
  teacher: {
    type: mongoose.Schema.ObjectId,
    ref: 'Person',
    neo_omit_rel: true
  }
});

Document lifecycle

Saving

Saving a mongo-document in neo4j is executed as you would normally. Therefore, return values will still be the same as without mongo4j. Post hooks of Document.save() & Model.insertMany() will cause the saved document(s) to be saved in neo4j as well.

Note: The hooks for saving in neo4j are executed asynchronously.

const Person = require('path/to/models/person');

neil = new Person({
  firstName: "Neil",
  lastName: "Young",
  address: {
    city: "Brentwood",
    street: "Barleau St."
  }
});

// Save 'neil' as a node in neo4j (as well as MongoDB) according to the schema configuration
neil.save();

const henry = new Person({firstName: "Henry", lastName: "McCoverty"});
const daniel = new Person({firstName: "Daniel", lastName: "Durval"});
const jason = new Person({firstName: "Jason", lastName: "Campbell"});

// Save all three persons in neo4j as well as MongoDB
Person.insertMany([daniel, jason, henry]);

Updating

Unfortunately, mongoose doesn't supply a direct way of accessing data in update hooks. Therefore a custom method on the document will be used that will both handle the saving in MongoDB and neo4j. It can be seen as a wrapper around the original Document.updateOne() method.

Document.updateNeo(criteria, options, cb)

  • Note: parameters are identical to that of Model.updateOne(). Detailed documentation can therefore be found here.
  • criteria: Data that should be changed (json format)
  • options: options for the updateOne() method executed. Refer to the documentation of mongoose for available options.
  • cb: Callback function to be executed by the updateOne() method.

Returns: a promise with a result of an array containing (in order):

  • Result of the updateOne method. See documentation
  • Result of the cypher update query
  • Result of the cypher query that deleted all the previous relationships. (If not executed this will be null). Why this query is executed is explained here.
// variable `person` refers to a document fetched from the database or returned as a result after saving

// Update the firstname to 'Peter' and lastname to 'Traverson'.
person.updateNeo({firstName: 'Peter', lastName: 'Traverson'}).then((results) => {
  // First item of the array is the result of the update query by mongoose
  let mongoUpdateResult = results[0];

  // Second item of the array is the result of the neo4j cypher query for updates
  let neo4jUpdateResult = results[1];

  // Third item of the array is the result of the delete query. In this case null,
  // because the updates didn't involve any changes in relationships between nodes.
  let neo4jDeleteResult = result[2];
});

Removing

Removing a mongo-document in neo4j is executed as you would normally. Post hooks of Document.remove() will cause the removed document(s) to be removed in neo4j as well (including subdocuments & relationships; not the related docs, of course).

// Remove 'neil' from neo4j as well as mongo
neil.remove()

Methods

Static

These methods can be called without an instance of an object. In other words, straight from the model.

Model.cypherQuery(query, params, options)

  • query: Cypher query to execute in string format.
  • params: Parameters of the query. More info on this in the neo4j driver-manual
  • options: Object with the following options for the query:
    • sub: Return a subscription. Can be used as explained here. Defaults to false
    • parse: Parse result with parse-neo4j. This is only available in the case of a Promise. If both options are true the query will throw an error. Defaults to false

Returns: a Promise with the result of the cypher query. or a subscription in case of sub-options set to true.

Note: The session is automatically closed after the query, only in the case of a promise!

const Person = require('./models/person');

// Basic usage with a cypher query
Person.cypherQuery('MATCH (n:Person)-[r:Takes_Class]-(c:Class) return n;')
  .then(result => {
    result.records.forEach(record => {
      console.log(record.get('name'))
    })
  })
  .catch(error => {
    console.log(error)
  })
// Run query with parse on for the result & using parameters for the query
Person.cypherQuery('MATCH (n:Person {name: $nameParam }) RETURN n;', {nameParam: 'James'}, { parse: true });
  .then(result => {
    result.records.forEach(record => {
      console.log(record.get('name'))
    })
  })
  .catch(error => {
    console.log(error)
  })
// Run query with sub on to handle the cypher query with the stream api
Person.cypherQuery('MATCH (n:Person) RETURN n;', { sub: true })
  .subscribe({
    onKeys: keys => {
      console.log(keys)
    },
    onNext: record => {
      console.log(record.get('name'))
    },
    onCompleted: () => {
      session.close() // returns a Promise
    },
    onError: error => {
      console.log(error)
    }
  })

Examples

For examples, refer to the test cases & test models for now.

FAQ

Why is there a deletion query in the update function?

After trying a couple of times, I couldn't find a consistent way of determining what nodes or relationships have changed and to what. At the time (may still be) the data also couldn't fit into a single query. In order to maintain flexibility and speed, a delete query has been added before refilling the neo4j database with the new relationships, nodes & data.

Upcoming features & to-do-list

Unfortunately, I don't have much time for keeping this repo up-to-date. However, from time to time I will try to have a look and see where I can fix or expand features. Right now all of the functionality described should work correctly and should cover the basic needs for scenarios where this package would be used.

Feel free to contribute by picking something from the to-do-list below and making a pull-request! I will check these every now and then

To-do-list:

  • Wrappers around static functions of a model (adding, updating & deleting)
  • Code documentation
  • Debug Mode (ie. show neo4j query's)
  • Helper functions for neo4j access
  • State hooks
  • Work with the new reactive sessions from neo4j

Credits

Big shoutout to srfrnk for creating the repo called moneo.

After some digging through the code, I missed some functionality and saw that the old HTTP driver for neo4j was used. I decided to rewrite the code with extra functionality and use the new neo4j driver with 'bolt' connection.

Moneo has provided me with the basic info to get started and mongo4j could be seen as a (continued) version 2.0.

mongo4j's People

Contributors

3rand avatar dependabot[bot] avatar greenkeeper[bot] avatar semantic-release-bot avatar snyk-bot avatar svenwesterlaken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mongo4j's Issues

An in-range update of semantic-release is breaking the build 🚨

The devDependency semantic-release was updated from 15.9.15 to 15.9.16.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v15.9.16

15.9.16 (2018-09-19)

Bug Fixes

  • package: update env-ci to version 3.0.0 (b9ae7d2)
Commits

The new version differs by 2 commits.

  • b9ae7d2 fix(package): update env-ci to version 3.0.0
  • c27e18e chore(package): update nock to version 10.0.0

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of semantic-release is breaking the build 🚨

The devDependency semantic-release was updated from 15.12.4 to 15.12.5.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v15.12.5

15.12.5 (2018-12-11)

Bug Fixes

  • allow to set ci option via API and config file (862ec4c)
Commits

The new version differs by 8 commits.

  • 649b530 docs: mention that debug option is CLI only
  • 862ec4c fix: allow to set ci option via API and config file
  • 6b110b6 docs: switch to spectrum.chat
  • e4c6649 docs: syntax fixes in plugins list
  • 6220641 docs: add @semantic-release/apm to plugins list
  • a45273e docs: add maven-semantic-release to list of community plugins
  • d109113 chore(package): update nyc and sinon
  • cd69583 test: delete unused test helper file

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

crashes on large syncing

Dear, SvenWesterlaken!

I have faced a problem syncing 6k docs.

Everything works well on tens docs. But when I started syncing a little bigger amount of docs mongo4j stops my express server at all.
I have disconected mongo4j, added all the docs into mongo, reconnected mongo4j and faced timeout limitation.

(on video you can see how elastic search synced all the docs and mongo4j crashes after 60 seconds)
https://youtu.be/kefmJE2S6dQ

I have changed config, as shown below, but there was no effect

const mongo4j = require("mongo4j");
console.log("mongo4j is executiong....");
// mongo4j.init('neo4j://localhost', {user: 'neo4j', pass: '123'});
mongo4j.init(
    "bolt://localhost",
    { user: "neo4j", pass: "123" },
    {
        encrypted: "ENCRYPTION_OFF",
        maxConnectionLifetime: 3 * 60 * 60 * 1000, // 3 hours
        maxConnectionPoolSize: 150,
    }
);

const mongo4jDriver = mongo4j.getDriver();

console.log("mongo4jDriver", mongo4jDriver);

// create session
const s = mongo4jDriver.session();

// transaction
(async () =>{
    r = await s.writeTransaction(tx => f(tx), {
        timeout: 99999999 // define timeout
    });

})()

module.exports = mongo4j;

Do you have any idea how to overcome this obstacle?

PS. I have changed "neo4j://...." on "bolt://...." in driver config, because of this message
Neo4jError: Could not perform discovery. No routing servers available. Known routing table: RoutingTable[database=default database, expirationTime=0, currentTime=1605783019325, routers=[], readers=[], writers=[]]
as said in this article

An in-range update of mongoose is breaking the build 🚨

The dependency mongoose was updated from 5.5.10 to 5.5.11.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mongoose is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 7 commits.

  • 09bc1a9 chore: release 5.5.11
  • 4d09963 refactor(discriminator): use one consolidated getConstructor() function to get the correct discriminator
  • ec01f4f fix(discriminator): allow numeric discriminator keys for embedded discriminators
  • e91fca1 test(discriminator): repro #7808
  • dc56c43 Merge pull request #7784 from Automattic/chore-node-12
  • c4fd03a chore: now working on 5.5.11
  • 10e8961 chore: add node 12 to travis

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of jshint is breaking the build 🚨

The devDependency jshint was updated from 2.10.0 to 2.10.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

jshint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for JSHint 2.10.1

2.10.1 (2019-02-05)

Bug Fixes

  • Do not add cls method names to env. record (036f085)
Commits

The new version differs by 2 commits.

  • 0e85de5 v2.10.1
  • 036f085 [[FIX]] Do not add cls method names to env. record

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of semantic-release is breaking the build 🚨

The devDependency semantic-release was updated from 15.12.3 to 15.12.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v15.12.4

15.12.4 (2018-11-30)

Bug Fixes

  • remove unnecessary branch parameter from push function (ffe1062)
Commits

The new version differs by 1 commits.

  • ffe1062 fix: remove unnecessary branch parameter from push function

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

If there are two or more Array Nested Ref pluging does not work

DISCLAIMER: it is on my version of a save file.

Dear SvenWesterlaken

I have schema

const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const mongoosastic = require("mongoosastic");
// const { schema } = require("./partNode");
const mongo4j = require("./plugins/mongo4j");
mongoose.set("debug", false);

// const NestedItemSchema = Schema({
//     id: { type: Schema.Types.ObjectId },
//     relScore: { type: Number, es_type: "long" },
// });

const PartanSchema = Schema(
    {
        desc: { type: String, es_indexed: true, neo_prop: true },
        metaDesc: { type: String, es_indexed: true },
        // mf: [
        //     {
        //         id: {
        //             type: Schema.Types.ObjectId,
        //             ref: "carModif",
        //             es_indexed: true,
        //             neo_rel_name: "MF_PT",
        //         },
        //         score: Number,
        //     },
        // ],
        
        gp: [
            {
                id: {
                    type: Schema.Types.ObjectId,
                    ref: "genPart",
                    es_indexed: true,
                    neo_rel_name: "GP_PT",
                },
                score: Number,
            },
        ],
    },
    { collection: "partan" }
);

PartanSchema.plugin(mongoosastic, {
    index: "partans",
    hosts: ["localhost:9200"],
    hydrate: true,
    hydrateOptions: { lean: true },
});
PartanSchema.plugin(mongo4j.plugin());

module.exports = mongoose.model("partan", PartanSchema);

// _id	name	partNumber	partSections	catalogs	analogsGroup


if I use only mf Array it works ok. It builds all the necessary nodes and relationships;
if I use only gp Array it works ok. It builds all the necessary nodes and relationships;

if I use both of them i get:

Neo4jError: Invalid input 'o': expected 'e/E' (line 3, column 257 (offset: 414))
"    ON MATCH SET doc.desc = 'тормозные колодки передние', doc.m_id = '5f9126b446cd8821bedf1a1b' WITH doc MATCH (I:Carmodif) WHERE I.m_id = '5f8e73cb62b1144467547ac7' MERGE (doc)-[r:MF_PT]->(I)  ON CREATE SET  r.score = 100 ON MATCH SET  r.score = 100WITH doc MATCH (II:Genpart) WHERE II.m_id = '5f8ebaa162b1144467547acf' MERGE (doc)-[r:GP_PT]->(II)  ON CREATE SET  r.score = 100 ON MATCH SET  r.score = 100"
                                                                                                                                                                                                                                                                 ^

    at captureStacktrace (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/neo4j-driver/lib/result.js:277:15)
    at new Result (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/neo4j-driver/lib/result.js:68:19)
    at Session._run (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/neo4j-driver/lib/session.js:174:14)
    at Session.run (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/neo4j-driver/lib/session.js:135:19)
    at Object.one (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/mongo4j/lib/save.js:30:13)
    at model.<anonymous> (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/mongo4j/lib/core.js:31:51)
    at callMiddlewareFunction (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/kareem/index.js:482:23)
    at next (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/kareem/index.js:193:9)
    at next (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/kareem/index.js:212:9)
    at Kareem.execPost (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/kareem/index.js:217:3)
    at _cb (/home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/kareem/index.js:307:15)
    at /home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/mongoose/lib/model.js:407:5
    at /home/nikolay/code/nodejs/servers/elasticSearchSandbox/node_modules/mongoose/lib/model.js:329:11
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  code: 'Neo.ClientError.Statement.SyntaxError'
}


and it seems to me that problem could be in Cypher Query building

Neo4jError: Invalid input 'o': expected 'e/E' (line 3, column 257 (offset: 414))
"    ON MATCH SET doc.desc = 'тормозные колодки передние', doc.m_id = '5f9126b446cd8821bedf1a1b' WITH doc MATCH (I:Carmodif) WHERE I.m_id = '5f8e73cb62b1144467547ac7' MERGE (doc)-[r:MF_PT]->(I)  ON CREATE SET  r.score = 100 ON MATCH SET  r.score = 100WITH doc MATCH (II:Genpart) WHERE II.m_id = '5f8ebaa162b1144467547acf' MERGE (doc)-[r:GP_PT]->(II)  ON CREATE SET  r.score = 100 ON MATCH SET  r.score = 100"
                                                                                                                                                                                                                                                                 ^

As you can see it combines 2 queries in one.

Probably you will face the same issue when start to refactor code.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

An in-range update of mongoose is breaking the build 🚨

The dependency mongoose was updated from 5.4.13 to 5.4.14.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mongoose is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 18 commits.

  • 35b90d2 chore: release 5.4.14
  • 8dc47a5 docs(schema): add examples for remaining functions
  • 764735b fix(documentarray): report validation errors that occur in an array subdoc created using create() and then set()
  • 3fec456 test(documentarray): repro #7504
  • 660fe60 chore: remove unnecessary print statements
  • 13c7a00 docs(schema): add examples to schema functions
  • 270732e docs(migrating_to_5): link to migrating to 5 docs on the mongoosejs.com website
  • db79cfc Merge branch 'master' of github.com:Automattic/mongoose
  • 67754bd style: fix lint
  • 8e30004 Merge pull request #7530 from sarpik/master
  • 3e44bc2 Merge branch 'master' of github.com:Automattic/mongoose
  • aa43200 docs: add MongooseError to API docs and add list of error names
  • 0daf626 Merge pull request #7521 from nocksapp/master
  • 8752502 fix anchor tag
  • b5f1723 chore: now working on 5.4.14

There are 18 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of mongoose is breaking the build 🚨

The dependency mongoose was updated from 5.2.17 to 5.2.18.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mongoose is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 16 commits.

  • 3084fcb chore: release 5.2.18
  • b844bca style: fix lint re: #5704
  • 53c39fa fix(populate): handle multiple localFields + foreignFields using localField: function() {} syntax
  • 0e2d638 test(populate): repro #5704
  • 55ad233 docs(aggregate): fix syntax highlighting on allowDiskUse() docs
  • 7c2eb93 docs(migrating_to_5): add note about overwriting filter properties
  • 9975182 fix(document): retain user-defined key order on initial set with nested docs
  • fd8e227 test(document): repro #6944
  • 8fea4f8 fix(query): correctly handle select('+c') if c is not in schema
  • 5ec10b6 test(query): repro #7017
  • 477e8ca test(model): add coverage for #6972
  • 05aa04d fix(document): check path exists before checking for required
  • 2221d72 chore: hide home page ad on mobile
  • b54ce42 style fix some more lint warnings
  • eedfc03 chore: now working on 5.2.18

There are 16 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of neo4j-driver is breaking the build 🚨

The dependency neo4j-driver was updated from 1.7.4 to 1.7.5.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

neo4j-driver is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of travis-deploy-once is breaking the build 🚨

The devDependency travis-deploy-once was updated from 5.0.8 to 5.0.9.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

travis-deploy-once is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v5.0.9

5.0.9 (2018-09-27)

Bug Fixes

  • use require.resolve to load babel preset (16292d3)
Commits

The new version differs by 2 commits.

  • 16292d3 fix: use require.resolve to load babel preset
  • 858d475 test: add babel-register.js to test coverage

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Mongo4j creates duplicates every time I save my project (nodemon)

What am I doing wrong?
I use mongoose and add mongo4j as a plugin.
There are 2 instances:
carMake:


const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const mongoosastic = require("mongoosastic");
const mongo4j = require("./plugins/mongo4j");

mongoose.set("debug", false);

const CarMakeSchema = Schema(
    {
        name: {
            type: String,
            required: true,
            es_indexed: true,
            neo_prop: true,
        },
        syns: {
            type: Array,
            es_indexed: true,
            es_boost: 1.0,
            es_type: "string",
        },
    },
    { collection: "carMake" }
);

CarMakeSchema.plugin(mongoosastic, {
    index: "makes",
    hosts: ["localhost:9200"],
    hydrate: true,
    hydrateOptions: { lean: true },
});
CarMakeSchema.plugin(mongo4j.plugin());

module.exports = mongoose.model("carMake", CarMakeSchema);

// _id	name	partNumber	CarMakeSections	catalogs	analogsGroup

and carModel:

const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const mongoosastic = require("mongoosastic");
const mongo4j = require("./plugins/mongo4j");
// const mongo4j = require("mongo4j");

mongoose.set("debug", false);
// mongo4j.init("neo4j://localhost", { user: "neo4j", pass: "123" });

const CarModelSchema = Schema(
    {
        name: {
            type: String,
            required: true,
            es_indexed: true,
            neo_prop: true,
        },
        syns: {
            type: Array,
            es_indexed: true,
            es_boost: 1.0,
            es_type: "string",
        },
        makes: {
            makeId: {
                type: Schema.Types.ObjectId,
                ref: "carMake",
                es_indexed: true,
                neo_rel_name: "MK_MD",
            },
            score: Number,
        },
        // makeId: {
        //     type: String,
        //     es_indexed: true,
        // },
    },
    { collection: "carModel" }
);

CarModelSchema.plugin(mongoosastic, {
    index: "models",
    hosts: ["localhost:9200"],
    hydrate: true,
    hydrateOptions: { lean: true },
});
CarModelSchema.plugin(mongo4j.plugin());

module.exports = mongoose.model("carModel", CarModelSchema);

// _id	name	partNumber	CarModelSections	catalogs	analogsGroup


And every time I save the project, my server restarts and I get new nodes and relationships to my Neo4j database.

"dependencies": {
        "axios": "^0.20.0",
        "axios-https-proxy-fix": "^0.17.1",
        "body-parser": "^1.19.0",
        "cheerio": "^1.0.0-rc.3",
        "cors": "^2.8.5",
        "csvtojson": "^2.0.10",
        "elasticsearch": "^16.7.1",
        "express": "^4.17.1",
        "fetch": "^1.1.0",
        "http-proxy-agent": "^4.0.1",
        "https-proxy-agent": "^5.0.0",
        "mongo4j": "^3.0.3",
        "mongoosastic": "^4.6.0",
        "mongoose": "^5.10.7",
        "node-fetch": "^2.6.1",
        "node-fetch-with-proxy": "^0.1.2",
        "nodemon": "^2.0.4",
        "puppeteer": "^5.3.1",
        "request": "^2.88.2",
        "request-promise-native": "^1.0.9",
        "selenium-webdriver": "^4.0.0-alpha.7",
        "socks-proxy-agent": "^5.0.0"
    }

What should I change to avoid creating nodes that are already in the database?

Or it is a feature with which I must live?)

video how it works

thanks)

An in-range update of semantic-release is breaking the build 🚨

The devDependency semantic-release was updated from 15.13.16 to 15.13.17.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v15.13.17

15.13.17 (2019-06-25)

Bug Fixes

  • package: update execa to version 2.0.0 (52c48be)
Commits

The new version differs by 2 commits.

  • 01a0b2d test: use regexp to check missing module message
  • 52c48be fix(package): update execa to version 2.0.0

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.