You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My solution didn't pass the tests. I saw these comments and doubted the test. So, I pimped out my solution to log tinas record before and after I updated it. I saw her age change from 30 to 40 and when I ran verify, it worked!
I thought I would share my working solution.
var mongo = require('mongodb').MongoClient
var url = "mongodb://localhost:27017/" + process.argv[2];
mongo.connect(url, function(err, db) {
if (err) throw err;
docs = db.collection('users')
tina = {
username: "tinatime"
}
docs.find(tina).toArray(function(err, data) {
if (err) throw err;
console.log(data);
docs.update(tina, { $set: {age: 40 }}, function(err
if (err) throw err;
docs.find(tina).toArray( function(err, data) {
if (err) throw err;
db.close()
console.log(data);
})
})
})
})
Hey,
While working on the update lesson, I wasn't able to get my code to pass, so I tried your solution and still had no luck.
I not sure if it has something to do with the versions of Node or Mongodb.
Let me know if this is enough information:
Mongodb version v3.2.1
Node v4.2.3
My solution: https://github.com/icodejs/nodeschool/blob/master/learnyoumongo/06-UPDATE/solution.js
Your solution: https://github.com/evanlucas/learnyoumongo/blob/master/exercises/update/solution/solution.js
Thanks!
The text was updated successfully, but these errors were encountered: