---
title: "Comment by Pratik Zinjurde on \"#100DaysOfMERN - Day 40\" | Hashnode"
description: "It would be very kind of you to solve this for me how can i get all the users whose users ids present in users friendlist array For reference u can see this htt"
url: "https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541"
---

[Discussion](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f)

Comment [#100DaysOfMERN - Day 40](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f)

[Pratik Zinjurde](https://hashnode.com/@pratikpz)

[Mar 5, 2021](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541)

It would be very kind of you to solve this for me how can i get all the users whose users ids present in users friendlist array For reference u can see this [stackoverflow.com/questions/66497145/how-can-i-ge…](https://stackoverflow.com/questions/66497145/how-can-i-get-all-the-users-whose-users-ids-present-in-users-friendlist-array)

[marayana](https://hashnode.com/@marayana)

[Mar 5, 2021](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541#reply-60428fb931ae032b9f3e970b)

Honey I'm still learning this like you, but I'll give it a shot 🤟

Since you have the array of friend IDs, I'd try the $or operator:

const list = YourModel.find({ $or: \[ { friendId\_1 }, { friendId\_2 }, ... \] })

Hope that works... (you're using mongoose, right?)

[Pratik Zinjurde](https://hashnode.com/@pratikpz)

[Mar 6, 2021](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541#reply-60437a205a56f82fa3ecbc2e)

Thanks [jsdisco](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/@jsdisco)

[Pratik Zinjurde](https://hashnode.com/@pratikpz)

[Mar 6, 2021](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541#reply-60437a808458d42fc821b0d5)

I got the solution I use aggregate function [jsdisco](https://hashnode.com/@jsdisco)

[marayana](https://hashnode.com/@marayana)

[Mar 6, 2021](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541#reply-6043b24d5a56f82fa3ecbf25)

Good to know, I have yet to explore how to write more advanced queries. That'll definitely be one of the next articles.

[Pratik Zinjurde](https://hashnode.com/@pratikpz)

[Mar 6, 2021](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541#reply-6043c3028458d42fc821b4a1)

yes it would be glad to read[jsdisco](https://hashnode.com/@jsdisco) also,i am working on chat webapp im using mern im currently stuck at messaging i fetched users friends in message component im not finding way how can i send them msg im thinking of using socket.io the current problem im facing is how can message particular user like when i click user i want to open the respective chat window how can i do it in react could you help me this is my repo [github.com/pratikpz18/Ping/blob/main/frontend/src…](https://github.com/pratikpz18/Ping/blob/main/frontend/src/components/Messages.js)  
i want do something like whatsapp(web app) like when u click on particular friends the window on right appears

[marayana](https://hashnode.com/@marayana)

[Mar 9, 2021](https://hashnode.com/posts/100daysofmern-day-40/6040de67ff443a0a449a0d2f/comment/60427d9b91eeac2b7aee8541#reply-6047d7c8c64c63545921c936)

I'd love to help you with this, but I'm really the wrong person to ask, two months ago I couldn't even set up a server...
