Example #1
0
 private static void Search() {
   // where方法很多,可参考官网RestAPI文档
   BSONObject where1 = new BSONObject(Bmob.whereLess(10));
   BSONObject where = new BSONObject();
   where.put("score", where1);
   // find方法很多,可自行尝试
   String result = Bmob.find("Your TableName", where.toString(), 0, 50, "order");
   Bmob.findBQL("BQL");
   Bmob.findBQL("BQL", "value");
   // 可使用JSON 或者 BSON 转换成Object
   //		BSONObject bson = new BSONObject(result);
 }
Example #2
0
  private static void callFunction() {
    BSONObject bson = new BSONObject();
    bson.put("param1", "a");
    bson.put("param2", 0);
    bson.put("param3", true);

    Bmob.callFunction("Your functionName", bson.toString());
  }
Example #3
0
 private static void count() {
   BSONObject where = new BSONObject();
   where.put("score", 100);
   Bmob.count("Your TableName", where.toString());
 }
Example #4
0
 private static void findPayOrder() {
   Bmob.findPayOrder("Your PayId");
 }
Example #5
0
 private static void insert() {
   BSONObject bson = new BSONObject();
   bson.put("student", "zhangsan");
   Bmob.insert("Your TableName", bson.toString());
 }
Example #6
0
 private static void delete() {
   Bmob.delete("Your TableName", "Your objectId");
 }
Example #7
0
 private static void update() {
   BSONObject bson = new BSONObject();
   bson.put("score", 100);
   // score 修改为100
   Bmob.update("Your TableName", "Your objectId", bson.toString());
 }
Example #8
0
 private static void requestSms() {
   String res = Bmob.requestSms("13168391111", "您的验证码是:222222, 有效期是10分钟。");
   System.out.println(res);
 }
Example #9
0
 private static void upload() {
   String res = Bmob.uploadFile2("/tmp/myPicture.jpg");
   System.out.println(res);
 }
Example #10
0
  // 使用RestAPI前必须先初始化,KEY可在Bmob应用信息里查询。
  private static void initBmob() {
    Bmob.initBmob("Your Bmob-Application-Id", "Your Bmob-REST-API-Key");

    // 用到超级权限需要注册该Key
    //		Bmob.initMaster("Your Bmob-Master-Key");
  }