Subversion Repositories SmartDukaan

Rev

Rev 14076 | Rev 14107 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14076 Rev 14083
Line 541... Line 541...
541
        return {1:'Cache cleared.'}
541
        return {1:'Cache cleared.'}
542
    except:
542
    except:
543
        return {0:'Unable to clear cache.'}
543
        return {0:'Unable to clear cache.'}
544
    
544
    
545
def updateCollection(data):
545
def updateCollection(data):
-
 
546
    print data
546
    try:
547
    try:
547
        collection = get_mongo_connection().Catalog[data['class']]
548
        collection = get_mongo_connection().Catalog[data['class']]
548
        data.pop('class')
549
        data.pop('class')
549
        _id = data.pop('oid')
550
        _id = data.pop('oid')
550
        collection.update({'_id':ObjectId(_id)},{"$set":data},upsert=False, multi = False)
551
        result = collection.update({'_id':ObjectId(_id)},{"$set":data},upsert=False, multi = False)
-
 
552
        print result
551
        #get_mongo_connection().Catalog.MasterData.update({'brand':data['brand'],'category_id':data['category_id']},{"$set":{'updatedOn':to_java_date(datetime.now())}},multi=True)
553
        #get_mongo_connection().Catalog.MasterData.update({'brand':data['brand'],'category_id':data['category_id']},{"$set":{'updatedOn':to_java_date(datetime.now())}},multi=True)
552
        return {1:"Data updated successfully"}
554
        return {1:"Data updated successfully"}
553
    except:
555
    except:
554
        return {0:"Data not updated."}
556
        return {0:"Data not updated."}
555
    
557