new Neo4jConnector(db)
Create an instance of Neo4jConnector.
Examples:
var neo4j = require('node-neo4j');
var acl = require('node-graph-acl');
var db = new neo4j('http://localhost:7474');
var connector = new acl.neo4jConnector(db);
This:
Parameters:
| Name | Type | Description |
|---|---|---|
db |
string | The database connection string. Format: http://username:password@domain:port |
- Source:
Methods
-
_getParameters(object, callback)
-
Get object parameters after extracting all _* parameters. Examples: connector._getParameters(node, callback);
Parameters:
Name Type Description objectObject Object. Can be a node, a relationship, or any object. callbackfunction Callback called when finished. - Source:
-
addNodeLabels(nodeId, labels, callback)
-
Add labels to a node. Examples: connector.addNodeLabels(1, ['l1', 'l2'], callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. labelsArray Labels to add. callbackfunction Callback called when finished. - Source:
-
addNodeProperties(nodeId, properties, callback)
-
Add properties to a node. Examples: connector.addNodeProperties(1, {p1:'v1', p2:'v2'}, callback);
Parameters:
Name Type Description nodeIdString | Number Node id. propertiesObject Properties to add. callbackfunction Callback called when finished. - Source:
-
addRelationship(from, to, type, properties, callback)
-
Create a relationship between two nodes. Properties can be added to the relationship. Examples: connector.addRelationship(1, 2, 'TYPE', {p1:'v1', p2:'v2'}, callback); connector.addRelationship(1, 2, 'TYPE', callback);
Parameters:
Name Type Description fromNumber | String From Node id. toNumber | String To Node id. typeString Relationship Type. propertiesObject Relationship properties. callbackfunction Callback called when finished. - Source:
-
addRelationshipProperties(relationshipId, properties, callback)
-
Add properties to a relationship. Examples: connector.addRelationshipProperties(1, {p1:'v1', p2:'v2'}, callback);
Parameters:
Name Type Description relationshipIdNumber | String Relationship id. propertiesObject Properties to add. callbackfunction Callback called when finished. - Source:
-
createNode(labels, properties, callback)
-
Create a node with given labels and properties. Examples: connector.createNode(callback); connector.createNode(['l1','l2'], callback); connector.createNode(['l1','l2'], {p1:'v1', p2:'v2'},, callback);
Parameters:
Name Type Description labelsArray Node labels. propertiesObject Node properties. callbackfunction Callback called when finished. - Source:
-
deleteNode(nodeId, callback)
-
Delete an existing node. Examples: connector.deleteNode(1, callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. callbackfunction Callback called when finished. - Source:
-
existsNodeWithLabel(label, callback)
-
Check existence of Nodes with given label. Examples: connector.existsNodeWithLabel('Test', callback);
Parameters:
Name Type Description labelString Label to search. callbackfunction Callback called when finished. - Source:
-
existsNodeWithLabelsAndProperties(labels, properties, callback)
-
Check existence of Nodes with given labels and properties. Examples: connector.existsNodeWithLabelsAndProperties('Label', {p1: 'v1', p2: 'v2'}, callback); connector.existsNodeWithLabelsAndProperties(['Label1', 'Label2'], {p1: 'v1', p2: 'v2'}, callback);
Parameters:
Name Type Description labelsString | Array Labels to search. propertiesObject Properties to search. callbackfunction Callback called when finished. - Source:
-
existsNodeWithProperties(properties, callback)
-
Check existence of Nodes with given properties. Examples: connector.existsNodeWithProperties({p1: 'v1', p2: 'v2'}, callback);
Parameters:
Name Type Description propertiesObject Properties to search. callbackfunction Callback called when finished. - Source:
-
existsRelationshipsBetweenNodes(from, to, type, callback)
-
Check existence of Relationships between two nodes. Examples: connector.getRelationshipBetweenNodes(1, 2, callback); connector.getRelationshipBetweenNodes(1, 2, 'TYPE', callback);
Parameters:
Name Type Description fromNumber | String From Node id. toNumber | String To Node id. typeString Relationship Type. callbackfunction Callback called when finished. - Source:
-
getNode(nodeId, callback)
-
Get a node. Examples: connector.getNode(1, callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. callbackfunction Callback called when finished. - Source:
-
getNodeLabels(nodeId, callback)
-
Get node labels. Examples: connector.getNodeLabels(1, callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. callbackfunction Callback called when finished. - Source:
-
getNodeProperties(nodeId, callback)
-
Get an existing node's properties. Examples: connector.getNodeProperties(1, callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. callbackfunction Callback called when finished. - Source:
-
getNodeRelationships(nodeId, options, callback)
-
Get a node relationships. Examples: var options = { types: ['TEST', ...] // optional direction: 'in' // optional, alternative 'out', defaults to 'all' } connector.getNodeRelationships(1, options, callback); connector.getNodeRelationships(1, {}, callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. optionsString Type of relationship: 'in', 'out' or 'all' (Default). Optional. callbackfunction Callback called when finished. - Source:
-
getNodesWithLabel(label, callback)
-
Get Nodes with given label. Examples: connector.getNodesWithLabel('Test', callback);
Parameters:
Name Type Description labelString Label to search. callbackfunction Callback called when finished. - Source:
-
getNodesWithLabelsAndProperties(labels, properties, callback)
-
Get Nodes with given labels and properties. Examples: connector.getNodesWithLabelsAndProperties('Label', {p1: 'v1', p2: 'v2'}, callback); connector.getNodesWithLabelsAndProperties(['Label1', 'Label2'], {p1: 'v1', p2: 'v2'}, callback);
Parameters:
Name Type Description labelsString | Array Labels to search. propertiesObject Properties to search. callbackfunction Callback called when finished. - Source:
-
getNodesWithProperties(properties, callback)
-
Get Nodes with given properties. Examples: connector.getNodesWithProperties({p1: 'v1', p2: 'v2'}, callback);
Parameters:
Name Type Description propertiesObject Properties to search. callbackfunction Callback called when finished. - Source:
-
getRelationship(relationshipId, callback)
-
Get a relationship. Examples: connector.getRelationship(1, callback);
Parameters:
Name Type Description relationshipIdNumber | String Relationship id. callbackfunction Callback called when finished. - Source:
-
getRelationshipProperties(relationshipId, callback)
-
Get a relationship properties. Examples: connector.getRelationshipProperties(1, callback);
Parameters:
Name Type Description relationshipIdNumber | String Relationship id. callbackfunction Callback called when finished. - Source:
-
getRelationshipsBetweenNodes(from, to, type, callback)
-
Get Relationships between two nodes. Examples: connector.getRelationshipBetweenNodes(1, 2, callback); connector.getRelationshipBetweenNodes(1, 2, 'TYPE', callback);
Parameters:
Name Type Description fromNumber | String From Node id. toNumber | String To Node id. typeString Relationship Type. callbackfunction Callback called when finished. - Source:
-
removeNodeLabels(nodeId, labels, callback)
-
Remove a label from a node. Examples: connector.removeNodeLabel(1, 'l1', callback); connector.removeNodeLabel(1, ['l1', 'l2'], callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. labelsString | Array Labels to remove. callbackfunction Callback called when finished. - Source:
-
removeNodeProperties(nodeId, properties, callback)
-
Removes properties from a node. Examples: connector.removeNodeProperties(1, ['p1', 'p2'], callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. propertiesObject Properties to remove. callbackfunction Callback called when finished. - Source:
-
removeRelationship(relationshipId, callback)
-
Remove relationship. Examples: connector.removeRelationship(1, callback);
Parameters:
Name Type Description relationshipIdNumber | String Relationship id. callbackfunction Callback called when finished. - Source:
-
removeRelationshipProperties(relationshipId, properties, callback)
-
Remove properties from a relationship. Examples: connector.removeRelationshipProperties(1, ['p1', 'p2'], callback);
Parameters:
Name Type Description relationshipIdNumber | String Relationship id. propertiesObject Properties to remove. callbackfunction Callback called when finished. - Source:
-
updateNode(nodeId, labels, properties, callback)
-
Update an existing node with given labels and properties. Note: All old properties and labels will be erased. Examples: connector.updateNode(1, callback); connector.updateNode(1, ['l1','l2'], callback); connector.updateNode(1, ['l1','l2'], {p1:'v1', p2:'v2'}, callback);
Parameters:
Name Type Description nodeIdNumber | String Node id. labelsArray Node labels. propertiesObject Node properties. callbackfunction Callback called when finished. - Source:
-
updateNodeProperties(nodeId, properties, callback)
-
Update properties of a node. Examples: connector.updateNodeProperties(1, {p1:'v1', p2:'v2'}, callback);
Parameters:
Name Type Description nodeIdString | Number Node id. propertiesObject Properties to replace with. callbackfunction Callback called when finished. - Source:
-
updateRelationship(relationshipId, properties, callback)
-
Update properties of a relationship between two nodes. Examples: connector.updateRelationship(1, {p1:'v1', p2:'v2'}, callback);
Parameters:
Name Type Description relationshipIdNumber | String Relationship id. propertiesObject Relationship properties. callbackfunction Callback called when finished. - Source:
-
updateRelationshipProperties(relationshipId, properties, callback)
-
Update properties of a relationship. Examples: connector.updateRelationshipProperties(1, {p1:'v1', p2:'v2'}, callback);
Parameters:
Name Type Description relationshipIdNumber | String Relationship ID. propertiesObject Properties to replace with. callbackfunction Callback called when finished. - Source: