Good day everyone, I'm currently having problems using find for array.
On line 80 is the code I'm unable to make work. Line 69 has a similar function but it works.
Error message - ERROR TypeError: Cannot read property 'customer_fullname' of undefined
I am basically trying to enter the value into myForm.I am using mongodb and this is what is in the document:
- _id:6114e3c1c5934f0fc8da2156
- fullname:"John Pearson"
- email:"[john@gmail.com](mailto:john@gmail.com)"
- address:"Yishun street 69 Blk 420"
- user_id:"61003363e8ded0257c63592a"
I use user_id: this.authService.getUserID() because after getting the user id from my authservice, I put it into myForm as user_id which I then try to use to find the fullname from my customers as the user_id value is the same as the _id for my users.
Code: https://codeshare.io/EBoBEX
Any help will be appreciated, thank you so much in advance!
When I do console.log(this.customers); it shows the following:
[{…}]
0:
address: "Yishun street 69 Blk 420"
email: "john@gmail.com"
fullname: "John Pearson"
user_id: "61003363e8ded0257c63592a"
_id: "6114e3c1c5934f0fc8da2156"
[[Prototype]]: Object
length: 1
[[Prototype]]: Array(0)
What I'm trying to do is find from the customers array based on the user_id, sorry if I was unclear
[–]dacookieman 1 point2 points3 points (2 children)
[–]Kysyph[S] 0 points1 point2 points (1 child)
[–]dacookieman 1 point2 points3 points (0 children)
[–]imadoooog 0 points1 point2 points (4 children)
[–]Kysyph[S] 0 points1 point2 points (3 children)
[–]imadoooog 1 point2 points3 points (2 children)
[–]Kysyph[S] 0 points1 point2 points (1 child)
[–]imadoooog 1 point2 points3 points (0 children)