Skip to content

Instantly share code, notes, and snippets.

@trishagee
Created May 6, 2014 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save trishagee/39e188182f8dc338dcc8 to your computer and use it in GitHub Desktop.
Save trishagee/39e188182f8dc338dcc8 to your computer and use it in GitHub Desktop.
public static final DBObject toDBObject(Person person) {
return new BasicDBObject("_id", person.getId())
.append("name", person.getName())
.append("address", new BasicDBObject("street", person.getAddress().getStreet())
.append("city", person.getAddress().getTown())
.append("phone", person.getAddress().getPhone()))
.append("books", person.getBookIds());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment