mern_stack_course's Issues
Autoincrement models/note.js
End of the controller lesson 4, I noticed that a POST to create a new note to a valid user:
It is leading to an unending request into postman.
I commented the autoincrement plugin, the issue is not there any more :
// noteSchema.plugin(AutoIncrement, {
// inc_field: 'ticket',
// id: 'ticketNums',
// start_seq: 500
// })
is this plugin still supported ?
Active: Boolean
The code block below that is inside the file usersController is missing the active parameter.
I added a sample code below it to be compared to the original code, if you have the time, thanks.
I realized that when I used the first code blocked below this line, I got back the following error after trying to POST a user. ("message": "User validation failed: active: Path active
is required.")
But after trying the second code block everything went smoothly including the duplicate validation.
This is my first time of raising an issue, please pardon my crudeness.
const userObject = { username, password: hashedPwd, roles};
const userObject = { username, password: hashedPwd, roles, active: true };
[Question] How to decode json content with backslashes
Hello. In the mern stack tutorial, is there any way to encode json content with backslashes on the backend? for example, if a passowrd contains a backslash.
"user" field validation fails in mongoose while typecasting to ObjectId
Error is in lesson_04
I encountered this error and can't get a hold of it.
This happens when trying to call a CREATE operation using POST, and it happens in the createNewNote
function in notesController.js .
Full error log in powershell's node server instance:
ValidationError: Note validation failed: user: Cast to ObjectId failed for value <string_value> (type string) at path "user" because of "BSONTypeError" at model.Document.invalidate (<path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\document.js:3050:32) at model.$set (<path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\document.js:1406:12) at model.$set (<path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\document.js:1089:16) at model.Document (<path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\document.js:166:12) at model.Model (<path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\model.js:119:12) at new model (<path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\model.js:4900:15) at <path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\model.js:3107:22 at <path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\model.js:3143:7 at Array.forEach (<anonymous>) at <path>\technotes\Sources\mern_stack_course\lesson_04\node_modules\mongoose\lib\model.js:3142:15
I hid my personal directories under <path>
, and the user i was trying to create the new note for under <string_value>
.
I first encountered the error in my code, then to troubleshoot i git cloned the repo and tried again using my .env file for the DATABASE_URI variable, and got the same error.
I also triple checked that the user i was trying to assign the note to existed in the DB.
New note not created due to this line of code
DB connectivity
Usually the DB connect was not working please update the code.
Response Awaited
In the createNewPost codes stop running after line "const note = await Note.create({ user, title, text })" when sending post request using Postman.
ValidationError: Note validation failed: user: Cast to ObjectId failed for value because of "BSONError"
Cannot make a newnote because of this error
ValidationError: Note validation failed: user: Cast to ObjectId failed for value "Havoc" (type string) at path "user" because of "BSONError"
here a user named 'Havoc' is trying to make a new note.
something to note:
my database uri is different where i dont' have the database name like 'techNotesDB' as in the case of the video
set up cookie for refresh end point
I did not find where set up the refreshToken cookie come from login end point for refresh end point to genrate new token
CSS not available on every route
Hi Dave, thanks for this wonderful epic course. Just wanted to point out that the following CSS code for 404 page doesn't work on every route such as /users/xyz
<link rel="stylesheet" href="css/style.css" />
This should also include a forward slash as follows:
<link rel="stylesheet" href="/css/style.css" />
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.