question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[beta] Test fails in Perform New Updates on a Document Using model.findOneAndUpdate()

See original GitHub issue

Challenge Name

https://beta.freecodecamp.org/en/challenges/mongodb-and-mongoose/perform-new-updates-on-a-document-using-modelfindoneandupdate

Issue Description

The test does not pass. The glitch logs:

11:38 AM
    process.nextTick(function() { throw err; });
11:38 AM
                                  ^
11:38 AM
11:38 AM
ReferenceError: data is not defined
11:38 AM
Jump to
at /app/server.js:197:11

Fix: in server.js line 197 move the statement

        if(!data) {
          console.log('Missing `done()` argument');
          return next({message: 'Missing callback argument'});
        }

in try {} after if(err) { return next(err) }

Browser Information

  • Browser Name, Version: Chrome, 62.0.3202.94
  • Operating System: Win 10
  • Mobile, Desktop, or Tablet: Desktop

Your Code




Screenshot

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
Brybrocommented, Feb 20, 2018

@raisedadead - Is this still open? If so, I can resolve it.

0reactions
raisedadeadcommented, Mar 6, 2018

Thanks @Em-Ant I’ll try and QA this ASAP

Read more comments on GitHub >

github_iconTop Results From Across the Web

Perform New Updates on a Document Using model ...
It seems there is a bug in the testing. It updates and returns in updated record in the console. However, it does not...
Read more >
09 - Perform New Updates Using model.findOneAndUpdate
Mongoose has some methods findOneAndUpdate() and findByIdAndUpdate() that allow us to update records in one step.
Read more >
Perform New Updates on a Document Using Model ... - YouTube
In this MongoDB and Mongoose tutorial we perform new updates on a document using Model. findOneAndUpdate. This is one section of many in ......
Read more >
FreeCodeCamp/HelpBackEnd - Gitter
Perform New Updates on a Document Using model.findOneAndUpdate() Recent versions of mongoose have methods to simplify documents updating.
Read more >
Mongoose.findOneAndUpdate() is not creating new document
The mongoose.findOneAndUpdate() method isn't creating new object when a new WEEKNUM is provided by the client. Instead it just updates the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found