public List<Person_login> readAllPerson() { List<Person_login> data = new ArrayList<Person_login>(); DBCursor cursor = col.find(); while (cursor.hasNext()) { DBObject doc = cursor.next(); Person_login p = PersonConverter.toPerson(doc); data.add(p); } return data; }
public Person_login getPerson(String email) { DBObject query = BasicDBObjectBuilder.start().append("email", email).get(); DBObject data = this.col.findOne(query); if (data == null) { return null; } else { return PersonConverter.toPerson(data); } }
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); }