docstr: Merges the fields of the given sample into this sample.
  
  The behavior of this method is highly customizable. By default, all
  top-level fields from the provided sample are merged in, overwriting
  any existing values for those fields, with the exception of list fields
  (e.g., ``tags``) and label list fields (e.g.,
  :class:`fiftyone.core.labels.Detections` fields), in which case the
  elements of the lists themselves are merged. In the case of label list
  fields, labels with the same ``id`` in both samples are updated rather
  than duplicated.
  
  To avoid confusion between missing fields and fields whose value is
  ``None``, ``None``-valued fields are always treated as missing while
  merging.
  
  This method can be configured in numerous ways, including:
  
  -   Whether new fields can be added to the dataset schema
  -   Whether list fields should be treated as ordinary fields and merged
      as a whole rather than merging their elements
  -   Whether to merge only specific fields, or all but certain fields
  -   Mapping input sample fields to different field names of this sample
  
  Args:
      sample: a :class:`fiftyone.core.sample.Sample`
      fields (None): an optional field or iterable of fields to which to
          restrict the merge. May contain frame fields for video samples.
          This can also be a dict mapping field names of the input sample
          to field names of this sample
      omit_fields (None): an optional field or iterable of fields to
          exclude from the merge. May contain frame fields for video
          samples
      merge_lists (True): whether to merge the elements of list fields
          (e.g., ``tags``) and label list fields (e.g.,
          :class:`fiftyone.core.labels.Detections` fields) rather than
          merging the entire top-level field like other field types.
          For label lists fields, existing
          :class:`fiftyone.core.label.Label` elements are either replaced
          (when ``overwrite`` is True) or kept (when ``overwrite`` is
          False) when their ``id`` matches a label from the provided
          sample
      overwrite (True): whether to overwrite (True) or skip (False)
          existing fields and label elements
      expand_schema (True): whether to dynamically add new fields
          encountered to the dataset schema. If False, an error is raised
          if any fields are not in the dataset schema
      validate (True): whether to validate values for existing fields
      dynamic (False): whether to declare dynamic embedded document
          fields
code: def merge(
      self,
      sample,
      fields=None,
      omit_fields=None,
      merge_lists=True,
      overwrite=True,
      expand_schema=True,
      validate=True,
      dynamic=False,
  ):
      """Merges the fields of the given sample into this sample.
  
      The behavior of this method is highly customizable. By default, all
      top-level fields from the provided sample are merged in, overwriting
      any existing values for those fields, with the exception of list fields
      (e.g., ``tags``) and label list fields (e.g.,
      :class:`fiftyone.core.labels.Detections` fields), in which case the
      elements of the lists themselves are merged. In the case of label list
      fields, labels with the same ``id`` in both samples are updated rather
      than duplicated.
  
      To avoid confusion between missing fields and fields whose value is
      ``None``, ``None``-valued fields are always treated as missing while
      merging.
  
      This method can be configured in numerous ways, including:
  
      -   Whether new fields can be added to the dataset schema
      -   Whether list fields should be treated as ordinary fields and merged
          as a whole rather than merging their elements
      -   Whether to merge only specific fields, or all but certain fields
      -   Mapping input sample fields to different field names of this sample
  
      Args:
          sample: a :class:`fiftyone.core.sample.Sample`
          fields (None): an optional field or iterable of fields to which to
              restrict the merge. May contain frame fields for video samples.
              This can also be a dict mapping field names of the input sample
              to field names of this sample
          omit_fields (None): an optional field or iterable of fields to
              exclude from the merge. May contain frame fields for video
              samples
          merge_lists (True): whether to merge the elements of list fields
              (e.g., ``tags``) and label list fields (e.g.,
              :class:`fiftyone.core.labels.Detections` fields) rather than
              merging the entire top-level field like other field types.
              For label lists fields, existing
              :class:`fiftyone.core.label.Label` elements are either replaced
              (when ``overwrite`` is True) or kept (when ``overwrite`` is
              False) when their ``id`` matches a label from the provided
              sample
          overwrite (True): whether to overwrite (True) or skip (False)
              existing fields and label elements
          expand_schema (True): whether to dynamically add new fields
              encountered to the dataset schema. If False, an error is raised
              if any fields are not in the dataset schema
          validate (True): whether to validate values for existing fields
          dynamic (False): whether to declare dynamic embedded document
              fields
      """
      if sample.media_type != self.media_type:
          raise ValueError(
              "Cannot merge sample with media type '%s' into sample with "
              "media type '%s'" % (sample.media_type, self.media_type)
          )
  
      if self.media_type == fomm.VIDEO:
          (
              fields,
              frame_fields,
              omit_fields,
              omit_frame_fields,
          ) = self._parse_fields_video(
              fields=fields, omit_fields=omit_fields
          )
  
      super().merge(
          sample,
          fields=fields,
          omit_fields=omit_fields,
          merge_lists=merge_lists,
          overwrite=overwrite,
          expand_schema=expand_schema,
          validate=validate,
          dynamic=dynamic,
      )
  
      if self.media_type == fomm.VIDEO:
          self.frames.merge(
              sample.frames,
              fields=frame_fields,
              omit_fields=omit_frame_fields,
              merge_lists=merge_lists,
              overwrite=overwrite,
              expand_schema=expand_schema,
              validate=validate,
              dynamic=dynamic,
          )
  
imports: import os
  from bson import ObjectId
  from fiftyone.core.document import Document, DocumentView
  import fiftyone.core.frame
  import fiftyone.core.frame_utils
  import fiftyone.core.labels
  import fiftyone.core.metadata
  import fiftyone.core.media
  import fiftyone.core.odm
  import fiftyone.core.utils
  from fiftyone.core.singletons import SampleSingleton
label_desc: Use image node_id 15 for calling the _SampleMixin obj's underlying member method code with example usage: obj.merge(sample, fields, omit_fields, merge_lists, overwrite, expand_schema, validate, dynamic) without return types