public Person_login createPerson(Person_login p) { DBObject doc = PersonConverter.toDBObject(p); this.col.insert(doc); ObjectId id = (ObjectId) doc.get("_id"); p.setId(id.toString()); return p; }
public Person_login readPerson(Person_login p) { DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get(); DBObject data = this.col.findOne(query); return PersonConverter.toPerson(data); }
public void deletePerson(Person_login p) { DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get(); this.col.remove(query); }
public void updatePerson(Person_login p) { DBObject query = BasicDBObjectBuilder.start().append("_id", new ObjectId(p.getId())).get(); this.col.update(query, PersonConverter.toDBObject(p)); }