MongoDB convert type of an element in array

0 votes
In MongoDB, I have a object array and the object has key value pair. As per given below sample, the array contains questions tag and there can be many answers for the question tag. Hence I want to convert the value field to array. Can someone help me and provide me the query. Thanks.

    "custom_questions": [
      {
        "question": "Time",
        "order": "5",
        "isRequired": "true",
        "type": "text",
        "createdDate": "11-11-2022",
        "value": "IST"
      },
      {
        "question": "Are you student",
        "order": "1",
        "isRequired": "true",
        "type": "text",
        "createdDate": "14-11-2022",
        "value": "Yes"
        
      },
      {
        "question": "Are you from",
        "order": "1",
        "isRequired": "true",
        "type": "Textbox",
        "value": "India",
        "createdDate": "18-11-2022"
      }]
Aug 7, 2023 in Database by Ramkumar

edited Mar 5 4 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP