Nodejs Blog Posts

Setup a basic node express app

Steps
install node and npm
initialize the project with npm init
install required packages
implement the code & run
npm init
will ask for few details and fill those

0 Likes 744 Views
How to reference documents in Mongodb

This article is helpful for those who are seriously looking and finding the usecase of reference documents in MongoDB. Referencing comes when we are saving data to database , that thing we obiously do through axios (Most Popular). Just place the below code inside any router where you want to and check the results.
Saving refs to other documents works the same way you normally save properties, just assign the _id value:
let Team = require('./team.model');
let Player = require('./player.model');
const team = new Team({
_id: new mongoose.Types.ObjectId(),
Name: 'KoderPlace',

0 Likes 966 Views