zoukankan      html  css  js  c++  java
  • Jongo --MongDB-ORM

    Jongo 通过内部实现的JSON Mapper等可以实现BsonDocument和对象之间的转换。

    Jongo 官网:http://jongo.org/

    public class Demo01 {
    @Ignore
    public void test01() {
    MongoClient mongo = new MongoClient("192.168.0.222", 27017);
    DB db = mongo.getDB("test");
    Jongo jungo = new Jongo(db);
    MongoCollection catagories = jungo.getCollection("category");

    Catagory catagory = new Catagory();
    catagory.setCate("CBBB");
    catagory.setExplain("EBBB");
    catagory.setParent("PBBB");
    Hobby hobby01 = new Hobby();
    hobby01.setName("NBBB");
    hobby01.setStfr("SBBB");
    Hobby hobby02 = new Hobby();
    hobby02.setName("2NBBB");
    hobby02.setStfr("2SBBB");
    catagory.setHobbies(ImmutableList.of(hobby01,hobby02));

    catagories.save(catagory);
    }

    @Test
    public void test02(){
    MongoClient mongo = new MongoClient("192.168.0.222", 27017);
    DB db = mongo.getDB("test");
    Jongo jungo = new Jongo(db);
    MongoCollection category = jungo.getCollection("category");
    MongoCursor<Catagory> catagories = category.find().as(Catagory.class);
    System.out.println("count:" + catagories.count());
    while(catagories.hasNext()){
    Catagory ca = catagories.next();
    System.out.println(ca.toString());
    }
    }
    }
  • 相关阅读:
    King's Quest
    Prince and Princess
    Strongly connected
    线性渐变--linear-gradient
    镜像渐变-radio-gradient
    宽度自适应-左右
    宽度自适应-左中右
    HTML5 视频规范简介
    SVG格式
    Html5新标签解释及用法
  • 原文地址:https://www.cnblogs.com/fight-tao/p/4895336.html
Copyright © 2011-2022 走看看