Skip to content

ndi.database.fun.scan_for_upload

 SCAN_FOR_UPLOAD - Scans the session for documents and files to upload. Calculate the size of the files.

  [DOC_JSON_STRUCT,DOC_FILE_STRUCT] = ndi.database.fun.scan_for_upload(S, d, new, DATASET_ID)

  Inputs:
   S - an ndi.session object
   d - documents returned by searching the session using database_search
   NEW - 1 if this is a new dataset with empty documents and files, 0 otherwise
   DATASET_ID - The dataset id. dataset_id = '' if it is a new dataset

  Outputs:
   DOC_JSON_STRUCT - A structure with the following fields:
     'docid' - The document id
     'is_uploaded' - A flag indicating if the document is uploaded
   DOC_FILE_STRUCT - A structure with the following fields:
     'uid' - The uid of the file
     'name' - The name of the file
     'docid' - The document id that the file is associated with
     'bytes' - The size of the file in bytes
     'is_uploaded' - A flag indicating if the file is uploaded
   TOTAL_SIZE - The total size of the files to upload in KB