Java heap space with MongoDB
try to increase heap size
JVM -- keys -Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size
Try to allow more memory for your JVM, with -Xmx1024m
option (for example): How to deal with "java.lang.OutOfMemoryError: Java heap space" error (64MB heap size)
How much data are you trying to save?I think you are trying to store large amount of data in one shot to MongoDB.