Learnmongo issue

I ran learnmongo run [solution.js] for the first time and it ran. It gave me an error because my code was bad. So I updated my code, saved it, and ran the code again.

The problem is it gave me the same error as before. This means that it did not update when I saved it? I even tried a new file and still got the same error from the initial file.

MacBook-Pro:mongo-learn Owner$ learnyoumongo run [solution.js]
/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37
  db.collection('parrots').remove({}, function(err) {
    ^
TypeError: Cannot read property 'collection' of undefined
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37:5)
    at next (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:271:17)
    at Exercise.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:277:5)
    at Workshopper.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:191:12)
    at Workshopper.done (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:323:19)
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:160:14)
    at /usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:147:16
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/filecheck.js:10:14)
    at FSReqWrap.oncomplete (fs.js:152:21)
MacBook-Pro:mongo-learn Owner$ learnyoumongo run [solution.js]
/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37
  db.collection('parrots').remove({}, function(err) {
    ^

TypeError: Cannot read property 'collection' of undefined
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37:5)
    at next (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:271:17)
    at Exercise.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:277:5)
    at Workshopper.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:191:12)
    at Workshopper.done (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:323:19)
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:160:14)
    at /usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:147:16
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/filecheck.js:10:14)
    at FSReqWrap.oncomplete (fs.js:152:21)
MacBook-Pro:mongo-learn Owner$ learnyoumongo run [milk.js]
/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37
  db.collection('parrots').remove({}, function(err) {
    ^

TypeError: Cannot read property 'collection' of undefined
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37:5)
    at next (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:271:17)
    at Exercise.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:277:5)
    at Workshopper.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:191:12)
    at Workshopper.done (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:323:19)
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:160:14)
    at /usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:147:16
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/filecheck.js:10:14)
    at FSReqWrap.oncomplete (fs.js:152:21)

MacBook-Pro:mongo-learn Owner$ learnyoumongo run [milk.js]
/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37
  db.collection('parrots').remove({}, function(err) {
    ^

TypeError: Cannot read property 'collection' of undefined
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/exercises/find/exercise.js:37:5)
    at next (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:271:17)
    at Exercise.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:277:5)
    at Workshopper.end (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:191:12)
    at Workshopper.done (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper/workshopper.js:323:19)
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:160:14)
    at /usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/exercise.js:147:16
    at Exercise.<anonymous> (/usr/local/lib/node_modules/learnyoumongo/node_modules/workshopper-exercise/filecheck.js:10:14)
    at FSReqWrap.oncomplete (fs.js:152:21)

both files had different code.

What am I doing wrong?

You have to give your file in argument without [ ]:
learnmongo run my_file.js

This part of training is obsolete.
I think FCC need to update it.
You need to add method db like:

mongo.connect(url, function (err, db) {
  var col = db.db('learnyoumongo').collection('parrots');
})

That is it.
Don’t look at the solution. All the solution won’t work anymore.

If you need assistance on the solution you could check my github: