I was interviewing for intern role. The interviewer asked me to demonstrate my projects. He asked me to do error handling with a project and was allowed to use google. I had to use mongoose for this. I was stuck at the beginning but after sometime I solved the issue. He wanted to know the reason why I was stuck and why I was getting the …
I was interviewing for intern role. The interviewer asked me to demonstrate my projects. He asked me to do error handling with a project and was allowed to use google. I had to use mongoose for this. I was stuck at the beginning but after sometime I solved the issue. He wanted to know the reason why I was stuck and why I was getting the error. Even after going through the mongoose docs I couldn't figure it out and then he explained me that.
I used findOne for query. He said that the callback err argument returns error if there is error in executing the query and not if the result is null. This is mentioned in docs but I was unable to find.
I was interviewing for intern role. The interviewer asked me to demonstrate my projects. He asked me to do error handling with a project and was allowed to use google. I had to use mongoose for this. I was stuck at the beginning but after sometime I solved the issue. He wanted to know the reason why I was stuck and why I was getting the error. Even after going through the mongoose docs I couldn't figure it out and then he explained me that.
What did he explain?
I used findOne for query. He said that the callback err argument returns error if there is error in executing the query and not if the result is null. This is mentioned in docs but I was unable to find.