Пример #1
0
def insertData(json):
    # insert (unique) date
    date = [int(s) for s in json['date'].split(',')]
    json["date"] = datetime.datetime(int(date[0]), int(date[1]), int(date[2]))

    date = [int(s) for s in json['fulldate'].split(',')]
    json["fulldate"] = datetime.datetime(int(date[0]), int(date[1]), int(date[2]), int(date[3]), int(date[4]), int(date[5]))

    # insert data json in data
    mongo_commons.insert(client, database, document_data, json)
    cursor = client[database][document_date].find({ "date" : json["date"]}).count()
    print cursor
    if ( cursor <= 0):
        insertDate({ "date" : json["date"] })
Пример #2
0
def insert_stats(json):
    id = mongo_commons.insert(client, database, document_stats, json)
    if ( id is not None ): print "Data Inserted ", id
    return id
Пример #3
0
def insertMetadata(json):
    return mongo_commons.insert(client, database, document_layer, json)
Пример #4
0
def insertDate(json):
    mongo_commons.insert(client, database, document_date, json)