def get(order_id): """ Get item from id """ coll = Order.collection() dic = coll.find_one({"_id": order_id}) return Order.unserialize(dic) if dic is not None else None
def get_all(user_id): coll = Order.collection() dic_lis = coll.find({ "user_id": user_id }) return [Order.unserialize(d) for d in dic_lis]