koa框架搭好了,想根据不同的路由对mongodb数据库进行数据的操作。
阮一峰的例子
阮一峰的例子并不适合我。不知道有没有比较好的方案。
ringa_lee2017-05-02 09:21:06
Perform data operations on mongodb database according to different routes
Are you talking about REST API? If so, there are already many third-party implementations. There is information about these frameworks in the document:
https://docs.mongodb.com/ecosystem/tools/http-interfaces/
Actually What framework to use and how to operate the database are two relatively independent issues. No matter what framework NodeJS uses to operate MongoDB, it cannot do without one of the two drivers: mongoose or node-mongodb native. As for when to call these drivers to access the database, it depends on the usage habits of KOA or other frameworks. So I don't see anything special that needs to be explained when using the koa framework and mongodb together. You can refine the problem a little more.