Fix compilation with JDK8. Minor polishing in mongo model