Example #1
0
 def _callback(mongo_client, **kwargs):
     tb = mongo_client[pet_def.PET_DATABASE][pet_def.PET_INFOS_TB]
     qcols = {"_id": 0}
     for v in cols:
         if not pet_def.has_pet_infos_col(v):
             raise PetMongoDAOException(
                 "Unknown pet infos row column \"%s\"", v)
         qcols[v] = 1
     cursor = tb.find(cond, qcols)
     if cursor.count() <= 0:
         return None
     return cursor[0]
Example #2
0
 def _callback(mongo_client, **kwargs):
     print "get_user_pets:", uid
     tb = mongo_client[pet_def.PET_DATABASE][pet_def.PET_INFOS_TB]
     qcols = {"_id": 0}
     for v in cols:
         if not pet_def.has_pet_infos_col(v):
             raise PetMongoDAOException(
                 "Unknown pet infos row column \"%s\"", v)
         qcols[v] = 1
     cursor = tb.find({"uid": uid, "choice": 1}, qcols)
     if cursor.count() > 0:
         return cursor[0]
     return None