- The change the referral chain
- Referral system using mongoDB a distributed General purpose database based on documents
installing the module
npm i referral-mongo
installing the database
sudo apt install -y mongodb
sudo systemctl start mongodb
const {
createReferal,
getReferrals,
updateReferal,
deleteReferral
} = require('referral-mongo')
returns a Promise:
createReferal({
userId: 1,
data:{example:"your data"}
})
returns a Promise:
createReferal({
userId: 2,
parentId:1,
data:{example:"your data"}
})
returns a Promise:
getReferrals(userId:5)
returns a Promise:
createReferal({
userId: 2,
data:{example:"your data"}
})
returns a Promise:
deleteReferal({
userId: 2,
data:{example:"your data"}
})
export REFERRAL_LEVELS=3
export REFERRAL_DATA_BASE='mongodb://localhost:27017/referrals'