Skip to content

Commit

Permalink
Applied fixes to use the new mongo URL parser
Browse files Browse the repository at this point in the history
Breaking changes were introduced to the gem so we now explicitly use the
new parser option.
  • Loading branch information
sgnn7 committed Nov 2, 2018
1 parent 1deb540 commit d43114e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chapter_3/prototype_service/application_server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ app.set('view engine', 'pug')
app.use(bodyParser.urlencoded({ extended: false }))

function loadWordsFromDatabase() {
return mongo.connect(dbUri).then(client => {
return mongo.connect(dbUri, { useNewUrlParser: true }).then(client => {
return client.db(DB_NAME).collection(COLLECTION_NAME).find({}).toArray();
})
.then((docs) => {
Expand All @@ -35,7 +35,7 @@ app.post('/new', (req, res) => {

console.info(`Got word: ${word}`);
if (word) {
mongo.connect(dbUri).then(client => {
mongo.connect(dbUri, { useNewUrlParser: true }).then(client => {
client.db(DB_NAME).collection(COLLECTION_NAME).insertOne({ word }, () => {
client.close();
words.push(word);
Expand Down
4 changes: 2 additions & 2 deletions chapter_4/clustered_application/application_server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ app.set('view engine', 'pug')
app.use(bodyParser.urlencoded({ extended: false }))

function loadWordsFromDatabase() {
return mongo.connect(dbUri).then(client => {
return mongo.connect(dbUri, { useNewUrlParser: true }).then(client => {
return client.db(DB_NAME).collection(COLLECTION_NAME).find({}).toArray();
})
.then((docs) => {
Expand All @@ -37,7 +37,7 @@ app.post('/new', (req, res) => {

console.info(`Got word: ${word}`);
if (word) {
mongo.connect(dbUri).then(client => {
mongo.connect(dbUri, { useNewUrlParser: true }).then(client => {
client.db(DB_NAME).collection(COLLECTION_NAME).insertOne({ word }, () => {
client.close();
});
Expand Down

0 comments on commit d43114e

Please sign in to comment.