how to find in mongo using object id references using nodejs?

how to find in mongo using object id references using nodejs?

i have two schemas

i have two schemas

var UserSchema  =new mongoose.Schema({


var friendRequestSchema=new mongoose.Schema({
    //1 for requested , 2 for accepted , 3 for rejected

and i want to find all friend requests with specific user id for requester field ,then i want to get all recipient users of these requests, and finally adding them to a dictionary where the key is the recipient user and the value is the friendRequest associated with it so i can pass it to a ejs file like this:


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

How to Use Express.js, Node.js and MongoDB.js

In this post, I will show you how to use Express.js, Node.js and MongoDB.js. We will be creating a very simple Node application, that will allow users to input data that they want to store in a MongoDB database. It will also show all items that have been entered into the database.

Build a REST API using Node.js, Express.js, Mongoose.js and MongoDB

Node.js, Express.js, Mongoose.js, and MongoDB is a great combination for building easy and fast REST API. You will see how fast that combination than other existing frameworks because of Node.js is a packaged compilation of Google’s V8 JavaScript engine and it works on non-blocking and event-driven I/O. Express.js is a Javascript web server that has a complete function of web development including REST API.

Fullstack Vue App with MongoDB, Express.js and Node.js

In this article, you'll learn building a fullstack Vue note-taking application and showing you how to perform the aforementioned processes, using Node.js running the Express.js framework for the back end, and MongoDB to store our data.