iddogino / mongotriggers Goto Github PK
View Code? Open in Web Editor NEWAdds the ability to add triggers and listeners to mongoDB operations, when using the mongoJS driver
Adds the ability to add triggers and listeners to mongoDB operations, when using the mongoJS driver
Hi,
When trying to use this:
triggers(db.users).update(function() {
console.log("Database Updated");
});
I keep getting this error:
D:\Projects\Easybike\node_modules\mongo-triggers\index.js:101
collection.save = injectTriggers(collection.save, triggers.save, listeners
^
TypeError: Cannot read property 'save' of undefined
at module.exports (D:\Projects\Easybike\node_modules\mongo-triggers\index.js:101:48)
at Object.<anonymous> (D:\Projects\Easybike\server.js:37:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Am I doing something wrong/what could be the problem?
Is there a way with use mongodb nodejs native driver ?
when i use triggers(db.collection("test")).on('insert'.....
its not triggered. But "mongojs" works well.
In the test.js exists error to run in node.js:
triggers(db.users).save(function (document, next) {
//Add a 'created' date to the new user
document.created = new Date();
next();
}
);
produce:
TypeError: next is not a function
at Collection. (/home/user/dev/mongoTriggers-master/test.js:8:9)
at next (/home/user/dev/mongoTriggers-master/index.js:97:25)
at Collection.save (/home/user/dev/mongoTriggers-master/index.js:99:13)
at Collection.save (/home/user/dev/mongoTriggers-master/node_modules/mongojs/lib/collection.js:112:47)
at next (/home/user/dev/mongoTriggers-master/index.js:96:31)
at Collection. (/home/user/dev/mongoTriggers-master/test.js:8:9)
at next (/home/user/dev/mongoTriggers-master/index.js:97:25)
at Collection.save (/home/user/dev/mongoTriggers-master/index.js:99:13)
at Object. (/home/user/dev/mongoTriggers-master/test.js:12:10)
at Module._compile (module.js:570:32)
Thanks for contributing your work to the community.
I was developing an application which requires event-triggers on a Mongo Database.
I had few queries:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.