def mongoimport(json, database,<EOL>ip='<STR_LIT:localhost>', port=<NUM_LIT>,<EOL>user=None, password=None,<EOL>delim='<STR_LIT:_>', delim1=None, delim2=None,<EOL>delim_occurance=<NUM_LIT:1>, delim1_occurance=<NUM_LIT:1>, delim2_occurance=<NUM_LIT:1>):
logger = log.get_logger('<STR_LIT>')<EOL>_print_mongoimport_info(logger)<EOL>if type(json) in (list, tuple):<EOL><INDENT>pass<EOL><DEDENT>elif os.path.isdir(json):<EOL><INDENT>from abtools.utils.pipeline import list_files<EOL>json = list_files(json)<EOL><DEDENT>else:<EOL><INDENT>json = [json, ]<EOL><DEDENT>jsons = sorted([os.path.expanduser(j) for j in json if j.endswith('<STR_LIT>')])<EOL>collections = _get_import_collections(jsons, delim, delim_occurance,<EOL>delim1, delim1_occurance,<EOL>delim2, delim2_occurance)<EOL>logger.info('<STR_LIT>'.format(len(jsons)))<EOL>logger.info('<STR_LIT>')<EOL>for i, (json_file, collection) in enumerate(zip(jsons, collections)):<EOL><INDENT>logger.info('<STR_LIT>'.format(i + <NUM_LIT:1>, os.path.basename(json_file), collection))<EOL>if all([user, password]):<EOL><INDENT>host = '<STR_LIT>'.format(ip, port, user, password)<EOL><DEDENT>else:<EOL><INDENT>host = '<STR_LIT>'.format(ip, port)<EOL><DEDENT>mongo_cmd = "<STR_LIT>".format(<EOL>host, database, collection, json_file)<EOL>mongo = sp.Popen(mongo_cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)<EOL>stdout, stderr = mongo.communicate()<EOL><DEDENT>
Performs mongoimport on one or more json files.

Args:

    json: Can be one of several things:

        - path to a single JSON file
        - an iterable (list or tuple) of one or more JSON file paths
        - path to a directory containing one or more JSON files

    database (str): Name of the database into which the JSON files
        will be imported

    ip (str): IP address of the MongoDB server. Default is ``localhost``.

    port (int): Port of the MongoDB database. Default is ``27017``.

    user (str): Username for the MongoDB database, if authentication is enabled.
        Default is ``None``, which results in attempting connection without
        authentication.

    password (str): Password for the MongoDB database, if authentication is enabled.
        Default is ``None``, which results in attempting connection without
        authentication.

    delim (str): Delimiter, when generating collection names using a single delimiter.
        Default is ``_``

    delim_occurance (int): Occurance at which to split filename when using a
        single delimiter. Default is ``1``

    delim1 (str): Left delimiter when splitting with two delimiters. Default is None.

    delim1_occurance (int): Occurance of ``delim1`` at which to split filename.
        Default is ``1``

    delim2 (str): Right delimiter when splitting with two delimiters. Default is None.

    delim2_occurance (int): Occurance of ``delim2`` at which to split filename.
        Default is ``1``