code: def queue_operation(
      self, **kwargs: Any
  ) -> DelegatedOperationDocument:
      op = DelegatedOperationDocument()
      for prop in self.required_props:
          if prop not in kwargs:
              raise ValueError("Missing required property '%s'" % prop)
          setattr(op, prop, kwargs.get(prop))
  
      # also set the delegation target (not required)
      delegation_target = kwargs.get("delegation_target", None)
      if delegation_target:
          setattr(op, "delegation_target", delegation_target)
  
      context = None
      if isinstance(op.context, dict):
          context = ExecutionContext(
              request_params=op.context.get("request_params", {})
          )
      elif isinstance(op.context, ExecutionContext):
          context = op.context
      if not op.dataset_id:
          # For consistency, set the dataset_id using the
          # ExecutionContext.dataset
          # rather than calling load_dataset() on a potentially stale
          # dataset_name in the request_params
          try:
              op.dataset_id = context.dataset._doc.id
          except:
              # If we can't resolve the dataset_id, it is possible the
              # dataset doesn't exist (deleted/being created). However,
              # it's also possible that future operators can run
              # dataset-less, so don't raise an error here and just log it
              # in case we need to debug later.
              logger.debug(
                  "Could not resolve dataset_id for operation. "
              )
      elif op.dataset_id:
          # If the dataset_id is provided, we set it in the request_params
          # to ensure that the operation is executed on the correct dataset
          context.request_params["dataset_id"] = str(op.dataset_id)
          context.request_params["dataset_name"] = context.dataset.name
  
      doc = self._collection.insert_one(op.to_pymongo())
      op.id = doc.inserted_id
      return DelegatedOperationDocument().from_pymongo(op.__dict__)
  
imports: import logging
  from datetime import datetime
  from typing import Any, List
  import pymongo
  from bson import ObjectId
  from pymongo import IndexModel
  from pymongo.collection import Collection
  from fiftyone.factory import DelegatedOperationPagingParams
  from fiftyone.factory.repos import DelegatedOperationDocument
  from fiftyone.operators.executor import ExecutionContext, ExecutionProgress, ExecutionResult, ExecutionRunState
label_desc: Use image node_id 4 for calling the MongoDelegatedOperationRepo obj's underlying member method code with example usage: obj.queue_operation() and returns: DelegatedOperationDocument