code: def up(db, dataset_name):
      match_d = {"name": dataset_name}
      dataset_dict = db.datasets.find_one(match_d)
  
      media_type = dataset_dict.get("media_type", None)
  
      for field in dataset_dict.get("sample_fields", []):
          name = field.get("name", None)
          ftype = field.get("ftype", None)
          embedded_doc_type = field.get("embedded_doc_type", None)
  
          # Upgrade `metadata` field to `media_type`-aware subclass
          if name == "metadata":
              if media_type == "image":
                  embedded_doc_type = (
                      "fiftyone.core.metadata.ImageMetadata"
                  )
              elif media_type == "video":
                  embedded_doc_type = (
                      "fiftyone.core.metadata.VideoMetadata"
                  )
              else:
                  embedded_doc_type = "fiftyone.core.metadata.Metadata"
  
              field["embedded_doc_type"] = embedded_doc_type
  
          # Populate embedded field schemas
          if ftype == "fiftyone.core.fields.EmbeddedDocumentField":
              try:
                  coll = db[dataset_dict["sample_collection_name"]]
                  field["fields"] = _infer_fields(
                      coll, name, embedded_doc_type
                  )
              except Exception as e:
                  print(
                      "Failed to infer schema of sample field '%s' of type "
                      "'%s': %s" % (name, embedded_doc_type, e)
                  )
                  field["fields"] = []
          else:
              field["fields"] = []
  
      for field in dataset_dict.get("frame_fields", []):
          name = field.get("name", None)
          ftype = field.get("ftype", None)
          embedded_doc_type = field.get("embedded_doc_type", None)
  
          # Populate embedded field schemas
          if ftype == "fiftyone.core.fields.EmbeddedDocumentField":
              try:
                  coll = db[dataset_dict["frame_collection_name"]]
                  field["fields"] = _infer_fields(
                      coll, name, embedded_doc_type
                  )
              except Exception as e:
                  print(
                      "Failed to infer schema of frame field '%s' of type "
                      "'%s': %s" % (name, embedded_doc_type, e)
                  )
                  field["fields"] = []
          else:
              field["fields"] = []
  
      dataset_dict["app_sidebar_groups"] = None
  
      db.datasets.replace_one(match_d, dataset_dict)
  
label_desc: Use image node_id 1 for calling a global function with example usage: up(db, dataset_name) without return types