skip to Main Content

mongodb. how map strings to integers from another collection

I have collection with documents, for example: [ { 'id':'1' 'some_field':'test', 'rates':[ {'user_id':'12','rate':'very_good'}, {'user_id':'13','rate':'very_good'} {'user_id':'14','rate':'bad'}, {'user_id':'15','rate':'normal'} ] } ] And i have collection with values of rates in string: [ { "rate_name" : "bad", "rate_value" : 1 }, { "rate_name"…

VIEW QUESTION

findbyID is not returning individual item in db, 404 not found error , mongodb, mongoose

I have the following Cycle Schema const mongoose=require('mongoose') const Schema = mongoose.Schema; const cycleSchema= new Schema({ startDate:{type:Date,required:true}, endDate:{type:Date,required:true}, users:[ { firstName:String, lastName:String, goals:[{ mainGoal:String, progress:{ type:Number, default:0 }, subTasks: [{ task:String, done:Boolean }] }] } ] },{ timestamps:true }) const…

VIEW QUESTION
Back To Top
Search