Mongoose2 Mongoose로 Node.js와 연결 시 DeprecationWarning // mongodb setup var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/mydb'); var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', function() { // we're connected! console.log('connected successfully'); }); 다음과 같은 Warning이 발생함(node:1876) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri().. 2017. 7. 6. Express에서 Mongoose로 DB 연결 1. npm을 통해 mongoose 모듈 설치 npm install mongoose 2. 자바스크립트 작성 connection-test.jsvar mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/mydb'); var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', function() { // we're connected! console.log('connected successfully'); }); 3. 실행 node connection-test.js 2017. 7. 6. 이전 1 다음