back-end/utils/export_collection_data_module.py
def export_to_json(cursor, dataset_name, path):
    """ This function extracts data from the cursor, then produces a valid json file with csv_header and saves it
        to the path.
    @parameters
        cursor          (cursor)    MongoDB's result cursor
        dataset_name    (str)       the name of the produced file
    """
    cursor = cursor.rewind()
    print("\tExporting Collection to json File...")
    if cursor.count() == 0:
        try:
            raise Warning("No documents retrieved")
        except Exception as e:
            print("\nexport_collection_data module > export_to_csv: ", e)
            return

    doc_cursor_list = list(cursor)
    docs = pd.DataFrame(doc_cursor_list)
    docs.to_json(path_or_buf=path+dataset_name, orient="records", lines=True)

    # -----------------------------------------------------------------------------------------------------------------#

 This function extracts data from the cursor, then produces a valid json file with csv_header and saves it
        to the path.
    @parameters
        cursor          (cursor)    MongoDB's result cursor
        dataset_name    (str)       the name of the produced file
    
This function extracts data from the cursor, then produces a valid json file with csv_header and saves it
to the path.
@parameters
cursor          (cursor)    MongoDB's result cursor
dataset_name    (str)       the name of the produced file
This function extracts data from the cursor then produces a valid json file with csv_header and saves it to the path . @parameters cursor ( cursor ) MongoDB ' s result cursor dataset_name ( str ) the name of the produced file
def export_to_json(cursor, dataset_name, path):
    cursor = cursor.rewind()
    print("\tExporting Collection to json File...")
    if cursor.count() == 0:
        try:
            raise Warning("No documents retrieved")
        except Exception as e:
            print("\nexport_collection_data module > export_to_csv: ", e)
            return
    doc_cursor_list = list(cursor)
    docs = pd.DataFrame(doc_cursor_list)
    docs.to_json(path_or_buf=path+dataset_name, orient="records", lines=True)
def export_to_json ( cursor , dataset_name , path ) : cursor = cursor . rewind ( ) print ( "\tExporting Collection to json File..." ) if cursor . count ( ) == 0 : try : raise Warning ( "No documents retrieved" ) except Exception as e : print ( "\nexport_collection_data module > export_to_csv: " , e ) return doc_cursor_list = list ( cursor ) docs = pd . DataFrame ( doc_cursor_list ) docs . to_json ( path_or_buf = path + dataset_name , orient = "records" , lines = True )
This function extracts data from the cursor, then produces a valid json file with csv_header and saves it
to the path.
This function extracts data from the cursor then produces a valid json file with csv_header and saves it to the path .
""" This function extracts data from the cursor, then produces a valid json file with csv_header and saves it
        to the path.
    @parameters
        cursor          (cursor)    MongoDB's result cursor
        dataset_name    (str)       the name of the produced file
    """ # -----------------------------------------------------------------------------------------------------------------#

cursor
dataset_name
path