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.

Two variables which are same

See original GitHub issue

Describe the Issue

The issue is in Backend Development and APIs Course, MongoDB and Mongoose section challenge “Create a Model”

In the instructions, we are asked to create a model called Person from personSchema by the code:

const Person = mongoose.model("Person", personSchema);

However in the folder boilerplate-mongomongoose, there is already an empty variable:

let Person;

Following the instructions gives a bug as the Person variable is already declared. We have to delete the empty variable in order to continue with the instructions. Maybe the hints should be corrected for the challenge or the variable name in the instruction should be changed.

Affected Page

https://www.freecodecamp.org/learn/back-end-development-and-apis/mongodb-and-mongoose/create-a-model

Your code


Expected behavior

We should not get an error after running the code.

Screenshots

No response

System

  • Device: [e.g. iPhone 6, Laptop]
  • OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04]
  • Browser: [e.g. Chrome, Safari]
  • Version: [e.g. 22]

Additional context

No response

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
naomi-lgbtcommented, Dec 12, 2022

Maybe the existing variable Person just for clarity?

0reactions
ojeytonwilliamscommented, Dec 12, 2022

So, it sounds like we can’t remove let Person; but we could clarify the wording slightly.

How about the following?

Now, create a model from the personSchema and assign it to the variable Person.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can Different Variables Have the Same Value? - Mashup Math
With this algebraic truth in mind, let's take a quick look at the simplest reason why two variables can have the same value,...
Read more >
Even if two variables refer to the same value, are they different ...
If two variables have the same value, such as int a=1; int b=1; , most languages will create two different objects. But some...
Read more >
What is the Difference Between “is” and “==” in Python
== operator is used to check whether two variables reference objects with the same value. · is operator is used to check whether...
Read more >
Example 4: Comparing Variables That Are in the Same Data Set
Specify two variables from the base data set to compare. The VAR and WITH statements specify the variables in the base data set...
Read more >
Check if multiple variables have the same value - Stack Overflow
If you have an arbitrary sequence, use the all() function with a generator expression: values = [x, y, z] # can contain any...
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