south-paw / koa-mongoose Goto Github PK
View Code? Open in Web Editor NEW๐ Mongoose middleware for Koa 2
License: MIT License
๐ Mongoose middleware for Koa 2
License: MIT License
Is there a way to interact with the db outside of koa's ctx? For instance, I want to do something like
var query = {'username': req.user.username};
req.newData.username = req.user.username;
MyModel.findOneAndUpdate(query, req.newData, {upsert: true}, function(err, doc) {
if (err) return res.send(500, {error: err});
return res.send('Succesfully saved.');
});
...but I do not have access to ctx.model
where I want to update this. Any ideas?
Every time I changes in my user collection, watch() getting fires change event no of time equal to no of changes. I hope you getting my or should i explain more?
ctx.model('users').watch().on('change', (change) => { console.log('emit'); });
Seeing these warnings
DeprecationWarning: The option `reconnectTries` is incompatible with the unified topology, please read more by visiting http://bit.ly/2D8WfT6
DeprecationWarning: The option `reconnectInterval` is incompatible with the unified topology, please read more by visiting http://bit.ly/2D8WfT6
Environment versions:
"mongodb": "^3.5.2",
"mongoose": "^5.8.10",
"@south-paw/koa-mongoose": "^1.1.0",
I'm trying to convert over to using this so as to start the connection with the Koa server, etc., however, I noticed that you don't actually seem to support the mongodb+srv://
protocol, which is what's recommended/forced by MongoDB Atlas. Furthermore, their documentation is written such that it seems as though no other form is supported. Do you have any intent on supporting that form, and if not, how does one work around it?
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.