
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Mongr is graph database built on the document-stored MongoDB and its for Node.js. Mongr using subj-pred-obj triplestores for storing graph data.
example data
{
subj : 'ali',
pred : 'follow',
obj : 'buddy'
}
on Node.js
npm install mongr --save
Initializing database
var mongr = require('mongr')
var db = mongr('your/mongodb/url/', 'graph-name')
// example
// var db = mongr('mongodb://localhost:27017/graphdb', 'mongr')
Data which inserted is must be an Array. Insert single or multiple data.
var insertData = [{
subj : 'ali',
pred : 'follow',
obj : 'ando'
}, {
subj : 'ando',
pred : 'follow',
obj : 'eddy'
}]
db.insert(insertData, function(err, result) {
// do something when inserting done
})
Triplestore can also adding with properties.
var insertData = [{
subj : 'ali',
pred : 'follow',
obj : 'ando',
time : new Date(),
cost : 10
}]
db.insert(insertData, function(err, result) {
// do something when inserting done
})
Searching graph data. Data must be array.
(subj) -: (pred) -> (obj)
example data
a -: follow -> b
a -: follow -> c
b -: follow -> c
b -: follow -> a
c -: follow -> d
Search who a follows.
var searchData = [{
subj : 'a',
pred : 'follow',
obj : '$following'
}]
db.search(searchData, function(err, result) {
console.log(result)
// result is something like this
// {
// following: ['b', 'c'],
// value: [ {...} ]
// }
})
Another example, Search who a follows and following back to 'a'.
var searchData = [{
subj : 'a',
pred : 'follow',
obj : '$following'
}, {
subj : '$following',
pred : 'follow',
obj : 'a'
}]
db.search(searchData, function(err, result) {
console.log(result)
// result is something like this
// {
// following: ['b'],
// value: [ {...} ]
// }
})
Another example, Search who a follows and not following back to a.
var searchData = [{
subj : 'a',
pred : 'follow',
obj : '!$notFolBack'
}, {
subj : '!$notFolBack',
pred : 'follow',
obj : 'a'
}]
db.search(searchData, function(err, result) {
console.log(result)
// result is something like this
// {
// notFolBack: ['c'],
// value: [ {...} ]
// }
})
Another example, Search follow of follow from a.
var searchData = [{
subj : 'a',
pred : 'follow',
obj : '$following'
}, {
subj : '$following',
pred : 'follow',
obj : '$followOfFollow'
}]
db.search(searchData, function(err, result) {
console.log(result)
// result is something like this
// {
// following: ['b', 'c'],
// followOfFollow: ['a', 'b', 'c', 'd'],
// value: [ {...} ]
// }
})
Updating multiple data.
db.update(
{
pred : 'follow'
},
{
pred : 'flw'
},
function(err, rowAffected) {
// do something when updating done
}
)
Deleting
db.delete({
pred : 'follow'
}, function(err, rowAffected) {
// do something when updating done
})
FAQs
graph database on top mongodb
The npm package mongr receives a total of 2 weekly downloads. As such, mongr popularity was classified as not popular.
We found that mongr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.