0

i am wondering how can i do to load a HashMap from MongoDB using Java, this is a project of mine for Minecraft & Bukkit. I have saved the data like the following:

private Map<String, String> petNames = new HashMap<String, String>();

and i am saving it like this:

representation.put("PetNames", petNames);

But i dont know how to actually after the user joins back again add all the data from "PetNames" to the petNames Map.

Does anyone know how to do this? Thanks.

ItsErikR
  • 11
  • 1
  • 3

1 Answers1

2

just cast it

petNames=(Map)yourDBCollection.findOne();
Dima
  • 8,586
  • 4
  • 28
  • 57