Explorar el Código

Update to nodejs 14.15.5 and mongodb, mongoose (#6362)

* Update node version for nodejs

* Fix nodejs mongodb-raw and postgres

* Fix nodejs mongoose

* Fix nodejs mongoose

* Update nodejs mongodb-raw
JaeHyeok Kim hace 4 años
padre
commit
13973f9920

+ 4 - 4
frameworks/JavaScript/nodejs/README.md

@@ -16,12 +16,12 @@ The server is currently in Alpha state, but aims to be a drop-in replacement for
 
 ## Infrastructure Software Versions
 The tests were run with:
-* [Node.js v8.1.0](http://nodejs.org/)
+* [Node.js v14.15.5](http://nodejs.org/)
 
-* [Node MySQL 2.15.0](https://github.com/felixge/node-mysql/)
-* [Sequelize 3.30.0](https://github.com/sequelize/sequelize)
+* [Node MySQL 2.16.0](https://github.com/felixge/node-mysql/)
+* [Sequelize 5.15.1](https://github.com/sequelize/sequelize)
 * [Node MongoDB Driver 2.2.33](https://github.com/mongodb/node-mongodb-native)
-* [Mongoose 4.12.4](http://mongoosejs.com/)
+* [Mongoose 5.7.5](http://mongoosejs.com/)
 
 ## Test URLs
 

+ 7 - 3
frameworks/JavaScript/nodejs/handlers/mongodb-raw.js

@@ -5,11 +5,15 @@ const collections = {
   World: null,
   Fortune: null
 };
-MongoClient.connect('mongodb://tfb-database/hello_world?maxPoolSize=5', (err, db) => {
+
+const mongoUrl = 'mongodb://tfb-database:27017';
+const dbName = 'hello_world';
+
+MongoClient.connect(mongoUrl, (err, database) => {
   // do nothing if there is err connecting to db
 
-  collections.World = db.collection('world');
-  collections.Fortune = db.collection('fortune');
+  collections.World = database.db(dbName).collection('world');
+  collections.Fortune = database.db(dbName).collection('fortune');
 });
 
 

+ 1 - 4
frameworks/JavaScript/nodejs/handlers/mongoose.js

@@ -1,10 +1,7 @@
 const h = require('../helper');
 const async = require('async');
 const Mongoose = require('mongoose');
-const connection = Mongoose.connect(
-  'mongodb://tfb-database/hello_world',
-  { useMongoClient: true }
-);
+const connection = Mongoose.createConnection('mongodb://tfb-database/hello_world');
 
 // Mongoose Setup
 const WorldSchema = new Mongoose.Schema({

+ 1 - 1
frameworks/JavaScript/nodejs/nodejs.dockerfile

@@ -1,4 +1,4 @@
-FROM node:14.15.1-slim
+FROM node:14.15.5-slim
 
 ARG TFB_TEST_NAME
 

+ 2 - 2
frameworks/JavaScript/nodejs/package.json

@@ -5,12 +5,12 @@
   "dependencies": {
     "async": "2.5.0",
     "handlebars": "4.3.0",
-  "mongodb": "2.2.33",
+    "mongodb": "3.6.4",
     "mongoose": "5.7.5",
     "mysql": "2.16.0",
     "mysql2": "1.6.5",
     "parseurl": "1.3.2",
-    "pg": "6.1.6",
+    "pg": "8.5.0",
     "pg-hstore": "2.3.2",
     "sequelize": "5.15.1",
     "node-cache": "4.1.1"