Java -MongoDB Add DBRef

Abstract: Java -MongoDB Add DBRef


          mongo = this.dao.getMongo (); Mongo // take the object, self-writing
          db = this.dao.getDB (mongo); // DB acquired object itself written
          DBCollection collection = db.getCollection (this.collection_name);
          obj.append ( "ref_field", new new DBRef (DB, "ref_collection_name", obj.getString ( "ref_field_id"))); 
          collection.save (obj)

Original: Big Box  Java -MongoDB Add DBRef


Guess you like

Origin www.cnblogs.com/chinatrump/p/11505384.html