0

i am working on a app inwhich anyone can purchase a product when one place his order there is some extra charges added i.e minimum delivery charge, GST, and these values are gereral data of my app, i just want to read and calculate accordingly, i want to store some data in the mongodb database and i dont want to make multiple document of these data. just want to read and update

data like => currentGST:18%, minDeliveryCharge:100, appVersion:"1.0.0", appName:"MyAwesomeApp", appSlogan:"Some Beautiful Slogan",

i handle it by creating a schema with these field and put a single document in it i read it by findOne() and limit(1) then document.currentGST and i don't thing this is the standard way. is there any standard way of doing this by which i can simply store data without creating multiple documents may be i am unable to describe my problem,sorry for that.

Any help appriciated, THANKS IN ADVANCE

1 Answers1

0

How about creating a Schema for all the values required for look-up. The Schema will have two fields, the label which will be an String and the value which can also be a string. You may also save timeStamps.

here is how it can be done...

const generalDataSchema= new mongoose.Schema({
label:{
    type:String,
    required:true
},
value:{
    type:String,
    required:true
} },{timeStamps:true});