I have a Mongo Document that contains a large list of primitive ints. Using the Java MongoDB API, I can store the int[] directly, for example:
DBCollection coll = test.getCollection("test");
int[] myInts = {3,4,5,56};
DBObject doc = new BasicDBObject("arr", myInts);
coll.insert(doc);
But when I retrieve the data, I get back a BasicDBList that contains Integer objects:
DBCollection coll = test.getCollection("test");
DBObject obj = coll.findOne();
BasicDBList list =(BasicDBList)obj.get("arr");
Is there a way of getting this data in the same form that I inserted it (int[])? Because the arrays are going to be very large, I don't want an Integer object created for every array element.