def save_to_mongo(self): StockDatabase.insert(self.collection, self.get_stock_data())
def remove_from_mongo(self): StockDatabase.remove(self.collection, self.json())
def get_all_stocks(cls) -> List: """return a list of class objects""" db_stocks = StockDatabase.find('stocks', {}) return [cls(stock['stock_symbol'], stock['shares'], stock['purchase_price'], stock['_id']) for stock in db_stocks]
def remove_from_mongo(id): StockDatabase.remove('stocks', id)