Exemple #1
0
    def test_dummy(self):
        bridge = Bridge()

        c = string.digits + string.ascii_letters
        n = string.digits

        for i in range(1,10):
            ranIDLen = random.randint(1,10)
            ranPWLen = random.randint(1,10)
            ranNameLen = random.randint(0,5)
            ranID  = ''.join(random.sample(c,ranIDLen))
            ranPW  = ''.join(random.sample(c,ranPWLen))
            ranName = ''.join(random.sample(c,ranNameLen))
            ranPhone = "010"+str(''.join(random.sample(n,8)))
            ranAddress = ''.join(random.sample(c,ranNameLen))
            doc = { 'id':ranID,'pw':ranPW,'name':ranName,'phone':ranPhone,'address':ranAddress}
#            doc = { 'name':ranName,'phone':ranPhone,'address':ranAddress}
#            doc = {'address':ranAddress}
#            doc = { 'id':ranID, 'address':ranAddress}
            try:
                pass
#                bridge.application('App3').schema('JoinPage').insert(doc)
            except:
                 print ("insert faild", sys.exc_info()[0])


        cursor = bridge.application('App3').schema('JoinPage').find({'phone':"01017935084"})
        data = json_util.dumps(cursor)
        print(data)

#        for i in range(1,50):
 #           bridge.application('App3').schema('JoinPage').find({'id':'1'},{'pw':'0'})

 #       for i in range(1,80):
 #           bridge.application('App3').schema('JoinPage').find({'name':'1'},{ 'phone':'0'})
Exemple #2
0
    def get(self):
        #client = MongoClient(self.__machine.addr, self.__machine.port )
        #db = client.db
        #result = db[self.__hostUrl].find(self.__hostQuery)
        bridge = Bridge(self.__machine)
        result = bridge.application('lesser').schema(self.__hostUrl).find(self.__hostQuery)
        print(result)


        return result
Exemple #3
0
    def post(self):
        #client = MongoClient(self.__machine.addr, self.__machine.port )
        #db = client.db
        #result = {'object_id' : db[self.__hostUrl].insert(self.__hostText).inserted_id}
        bridge = Bridge(self.__machine)
        result = {'object_id' :
                      bridge.application('lesser')
                          .schema(self.__hostUrl)
                          .insert(self.__hostText).inserted_id
                  }

        print(result)

        return result