class_docstr: Move data from MongoDB to S3.
  
  .. seealso::
      For more information on how to use this operator, take a look at the guide:
      :ref:`howto/operator:MongoToS3Operator`
  
  :param mongo_conn_id: reference to a specific mongo connection
  :param aws_conn_id: reference to a specific S3 connection
  :param mongo_collection: reference to a specific collection in your mongo db
  :param mongo_query: query to execute. A list including a dict of the query
  :param mongo_projection: optional parameter to filter the returned fields by
      the query. It can be a list of fields names to include or a dictionary
      for excluding fields (e.g ``projection={"_id": 0}`` )
  :param s3_bucket: reference to a specific S3 bucket to store the data
  :param s3_key: in which S3 key the file will be stored
  :param mongo_db: reference to a specific mongo database
  :param replace: whether or not to replace the file in S3 if it previously existed
  :param allow_disk_use: enables writing to temporary files in the case you are handling large dataset.
      This only takes effect when `mongo_query` is a list - running an aggregate pipeline
  :param compression: type of compression to use for output file in S3. Currently only gzip is supported.
class_docstr_tok: ["Move","data","from","MongoDB","to","S3",".","..","seealso",":",":","For","more","information","on","how","to","use","this","operator",",","take","a","look","at","the","guide",":",":","ref",":","`","howto\/operator",":","MongoToS3Operator","`",":","param","mongo_conn_id",":","reference","to","a","specific","mongo","connection",":","param","aws_conn_id",":","reference","to","a","specific","S3","connection",":","param","mongo_collection",":","reference","to","a","specific","collection","in","your","mongo","db",":","param","mongo_query",":","query","to","execute",".","A","list","including","a","dict","of","the","query",":","param","mongo_projection",":","optional","parameter","to","filter","the","returned","fields","by","the","query",".","It","can","be","a","list","of","fields","names","to","include","or","a","dictionary","for","excluding","fields","(","e.g","``","projection=","{","``","_id","''",":","0","}","``",")",":","param","s3_bucket",":","reference","to","a","specific","S3","bucket","to","store","the","data",":","param","s3_key",":","in","which","S3","key","the","file","will","be","stored",":","param","mongo_db",":","reference","to","a","specific","mongo","database",":","param","replace",":","whether","or","not","to","replace","the","file","in","S3","if","it","previously","existed",":","param","allow_disk_use",":","enables","writing","to","temporary","files","in","the","case","you","are","handling","large","dataset",".","This","only","takes","effect","when","`","mongo_query","`","is","a","list","-","running","an","aggregate","pipeline",":","param","compression",":","type","of","compression","to","use","for","output","file","in","S3",".","Currently","only","gzip","is","supported","."]
code: def __init__(
      self,
      *,
      mongo_conn_id: str = "mongo_default",
      aws_conn_id: str = "aws_default",
      mongo_collection: str,
      mongo_query: list | dict,
      s3_bucket: str,
      s3_key: str,
      mongo_db: str | None = None,
      mongo_projection: list | dict | None = None,
      replace: bool = False,
      allow_disk_use: bool = False,
      compression: str | None = None,
      **kwargs,
  ) -> None:
      super().__init__(**kwargs)
      self.mongo_conn_id = mongo_conn_id
      self.aws_conn_id = aws_conn_id
      self.mongo_db = mongo_db
      self.mongo_collection = mongo_collection
  
      # Grab query and determine if we need to run an aggregate pipeline
      self.mongo_query = mongo_query
      self.is_pipeline = isinstance(self.mongo_query, list)
      self.mongo_projection = mongo_projection
  
      self.s3_bucket = s3_bucket
      self.s3_key = s3_key
      self.replace = replace
      self.allow_disk_use = allow_disk_use
      self.compression = compression
  
file_path: airflow/airflow/providers/amazon/aws/transfers/mongo_to_s3.py
imports: from __future__ import annotations
  import json
  from typing import TYPE_CHECKING, Any, Iterable, Sequence, cast
  from bson import json_util
  from airflow.models import BaseOperator
  from airflow.providers.amazon.aws.hooks.s3 import S3Hook
  from airflow.providers.mongo.hooks.mongo import MongoHook
label_desc: Use image node_id 1 to create a new MongoToS3Operator object from inherited base classes: BaseOperator with example: obj = MongoToS3Operator()