def update_loan_entry ( database , entry ) : entry = clean_entry ( entry ) database . loans . update ( { 'recordID' : entry [ 'recordID' ] } , { '$set' : entry } , upsert = True )
python mongodb add field to another field
Update a record of a loan report in the provided database .
def update_loan_entry(database, entry):
    """Update a record of a loan report in the provided database.

    @param db: The MongoDB database to operate on. The loans collection will be
        used from this database.
    @type db: pymongo.database.Database
    @param entry: The entry to insert into the database, updating the entry with
        the same recordID if one exists.
    @type entry: dict
    """
    entry = clean_entry(entry)
    database.loans.update(
        {'recordID': entry['recordID']},
        {'$set': entry},
        upsert=True
    )