I am saving data from CSV using csvjson
module. and my schema is as follows
name:{type:String}, // abc
email:{type:String}, //abc@mail.com
occupationType:{type:String} // company or business
companyName:{type:String},
companyOwner:{type:String},
businessName:{type:String},
businessType:{type:String},
businessOwner:{type:String}
In the above schema either company related will be entered or business related will be entered but both will not be entered together. Now I want to fetch those details on the basis of occupationType
like below in which json shcema I want to return :
If occupationType
contains company
then my json schema should be like that
name:{type:String},
email:{type:String},
company:[{
companyName:String,
companyOwner:String
}]
And if occupationType
contains business
then my json schema should be like that
name:{type:String},
email:{type:String},
business:[{
businessName:String,
businessType:String,
businessOwner:String
}]
Plz let me know how I can achieve that.
Thanks
via Saurabh Sharma
No comments:
Post a Comment