# Path: lib/_db.py
# def get_collection(db_name, collection_name, client='mongo'):
#     client = client_db_map.get(client)
#     db = getattr(client, db_name, None)
#     return getattr(db, collection_name, None)


import _env
import io
import json
import re
import time
    import sys
from lib._db import get_collection
from config.config import CONFIG
from judge_upload import exist_or_insert

    for doc in coll.find().skip(skip).limit(limit):
        title = doc.get('title')
        slug = title.lower().strip()

        if slug and (slug not in slug_set):
            slug_set.add(slug)
            doc['slug'] = slug

            if not exist_or_insert(slug):
                doc_id = doc.get('_id')
                post_id = int(doc['source_url'].rsplit('/', 1)[1].split('.')[0])

                posts.append(replace_post(doc))
                posts_tags.append(
                    {"tag_id": 1, "post_id": post_id}
                )

    data = {
        "posts": posts,
        "tags": TAGS,
        "posts_tags": posts_tags,
        "users": USERS
    }
    res["data"] = data
    return res


def tag_migrate(limit=10):
    res = {

# Path: lib/_db.py
# def get_collection(db_name, collection_name, client='mongo'):
#     client = client_db_map.get(client)
#     db = getattr(client, db_name, None)
#     return getattr(db, collection_name, None)


# Path: crawler/ahlinux/ahlinux_to_ghost.py
import _env
import io
import json
import re
import time
    import sys
from lib._db import get_collection
from config.config import CONFIG
from judge_upload import exist_or_insert


    for doc in coll.find().skip(skip).limit(limit):
        title = doc.get('title')
        slug = title.lower().strip()

        if slug and (slug not in slug_set):
            slug_set.add(slug)
            doc['slug'] = slug

            if not exist_or_insert(slug):
                doc_id = doc.get('_id')
                post_id = int(doc['source_url'].rsplit('/', 1)[1].split('.')[0])

                posts.append(replace_post(doc))
                posts_tags.append(
                    {"tag_id": 1, "post_id": post_id}
                )

    data = {
        "posts": posts,
        "tags": TAGS,
        "posts_tags": posts_tags,
        "users": USERS
    }
    res["data"] = data
    return res


def tag_migrate(limit=10):
    res = {

        "meta": {