Is there a way to save enum into the mongoDB? I want to save something like:
public enum SnapshotType {
EVENT,
MEMORY
}
I assume you mean saving an enum value into a collection.
Basically, you just add it into your entity model, like so:
@Document(collection = "MyEntity ")
public class MyEntity {
public SnapshotType snapshotType;
}
It will store it as a string in mongo, and automagically convert when you read it out.