def store_user_documents(user_document_gen, client, mongo_database_name, mongo_collection_name):
    """
    Stores Twitter list objects that a Twitter user is a member of in different mongo collections.

    Inputs: - user_document_gen: A python generator that yields a Twitter user id and an associated document list.
            - client: A pymongo MongoClient object.
            - mongo_database_name: The name of a Mongo database as a string.
            - mongo_collection_name: The name of the mongo collection as a string.
    """
    mongo_database = client[mongo_database_name]
    mongo_collection = mongo_database[mongo_collection_name]

    # Iterate over all users to be annotated and store the Twitter lists in mongo.
    for user_twitter_id, user_document_list in user_document_gen:
        document = user_document_list
        document["_id"] = int(user_twitter_id)
        mongo_collection.update({"_id": user_twitter_id}, document, upsert=True)
def store_user_documents ( user_document_gen , client , mongo_database_name , mongo_collection_name ) : mongo_database = client [ mongo_database_name ] mongo_collection = mongo_database [ mongo_collection_name ] for user_twitter_id , user_document_list in user_document_gen : document = user_document_list document [ "_id" ] = int ( user_twitter_id ) mongo_collection . update ( { "_id" : user_twitter_id } , document , upsert = True )
Stores Twitter list objects that a Twitter user is a member of in different mongo collections.

    Inputs: - user_document_gen: A python generator that yields a Twitter user id and an associated document list.
            - client: A pymongo MongoClient object.
            - mongo_database_name: The name of a Mongo database as a string.
            - mongo_collection_name: The name of the mongo collection as a string.