This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = await leads.update({email:email},{returning: true,where:{active:1,id:id}}); | |
res.send({success:true, data:data}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MongoDB Path: | |
cd "Program Files\MongoDB\Server\5.0\bin" | |
MongoDb Ultimate Cheat Sheet: | |
https://www.codewithharry.com/blogpost/mongodb-cheatsheet |