steevej
(Steeve Juneau)
2
In the code you share the only place we see _id access is in
Since you use user[0] then it must be that user[0] really does not exist. You code is not safe because you use the result of db…find() without testing for a result or not. Many reasons might explain why you do not get user[0].
- You are not connected to the appropriate server
- You are not using the appropriate database
- You are not calling getCollection() with the appropriate collection name
- There is no user that matches { “email” : email }
- You might need to await when you initialize user with “db…find(…)”
1 Like