Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问怎么把mongoose和pomelo结合起来使用 #1087

Open
NiborZ opened this Issue Jul 17, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@NiborZ
Copy link

NiborZ commented Jul 17, 2018

求助大家,网上只找到一个例子,但是里面的var db = mongoose.connect(mongodb_config.host, mongodb_config.database, mongodb_config.port, mongodb_config.options).connection;
这句话报错,求正确的连接方法

@whtiehack

This comment has been minimized.

Copy link

whtiehack commented Jul 17, 2018

@wildwolf113

This comment has been minimized.

Copy link

wildwolf113 commented Aug 3, 2018

var mongoose = require('mongoose');

mongoose.connect(dbURL, options, function (err) {});

var DB = function () {
this.mongoClient = {};
});

DB.prototype.findOne= function (table_name, conditions, callback) {

 var model = mongoose.model;   
 model.findOne()

}

差不多就这个思路吧。

可以参考这个
https://www.cnblogs.com/yangjinjin/p/5371415.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.