Authentication and Authorization - 3

I have a problem in section 3 in “Authentication and Authorization”, when I try to create a user with invalid email like Mosh tried himself.
Someone know why it’s doesn’t work for me?

This is the error then occured in my terminal:
“(node:11412) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
(Use node --trace-deprecation ... to show where the warning was created)
Connected to MongoDB…
SyntaxError: Unexpected token S in JSON at position 11
at JSON.parse ()
at parse (C:\Users\SharelShalom\Desktop\COMPUTER\nodeCourse\vidly\node_modules\body-parser\lib\types\json.js:89:19)
at C:\Users\SharelShalom\Desktop\COMPUTER\nodeCourse\vidly\node_modules\body-parser\lib\read.js:121:18
at invokeCallback (C:\Users\SharelShalom\Desktop\COMPUTER\nodeCourse\vidly\node_modules\raw-body\index.js:224:16)
at done (C:\Users\SharelShalom\Desktop\COMPUTER\nodeCourse\vidly\node_modules\raw-body\index.js:213:7)
at IncomingMessage.onEnd (C:\Users\SharelShalom\Desktop\COMPUTER\nodeCourse\vidly\node_modules\raw-body\index.js:273:7)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)”

I’m not sure this is the specific problem you are talking about, but I read the other day MongoDB still uses collection.ensureIndex. To fix this I did:
mongoose
.connect(“mongodb://localhost:27017/vidly”, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false, //needed for findByIdAndUpdate
useCreateIndex: true,
})

The useCreateIndex is the part that fixes the depreciation warning. Im not sure that completely fixes your problem, but I am just a bit further ahead than you so I can try and help you. Maybe its something to do with one of the schemas.