Skip to content

Instantly share code, notes, and snippets.

View bharatsewani1993's full-sized avatar
🎯
Focusing

Bharat Sewani bharatsewani1993

🎯
Focusing
View GitHub Profile
@bharatsewani1993
bharatsewani1993 / SequlizeJoin
Created December 31, 2021 13:06
Sequlize Join
https://stackoverflow.com/questions/20460270/how-to-make-join-queries-using-sequelize-on-node-js
User.hasMany(Post, {foreignKey: 'user_id'})
Post.belongsTo(User, {foreignKey: 'user_id'})
Post.find({ where: { ...}, include: [User]})
exports.getRelatedProducts = async (req, res) => {
try {
Model.Product.hasMany(Model.RelatedProducts, {foreignKey: 'product_id'})
@bharatsewani1993
bharatsewani1993 / sequelize-update.js
Last active January 17, 2022 07:48
sequelize-update-query, sequlize-nodejs-update-function
const data = await leads.update({email:email},{returning: true,where:{active:1,id:id}});
res.send({success:true, data:data});
@bharatsewani1993
bharatsewani1993 / mongo-db-path
Last active December 21, 2021 07:35
Mongo D path
MongoDB Path:
cd "Program Files\MongoDB\Server\5.0\bin"
MongoDb Ultimate Cheat Sheet:
https://www.codewithharry.com/blogpost/mongodb-cheatsheet