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

MongoDB view with dynamic dates

I am trying to create a view for records created/modified in last 24 hours. Is it possible? Tried creating view as below db.createView( "viewname", "sourcecollection", [ { $match: {"modifiedTime":{$gte:new Date(Date.now() - 24*60*60*1000), $lte:new Date()}}}] ) But it translates to static…

VIEW QUESTION
Back To Top
Search