I am trying to update at once fields in amount of document, I want to modify
"download=0" where "md5" is in the list. When I run the code, it throws an exception:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
This is what I am doing:
//the list is an list of "md5"
List<BasicDBObject> updateCondition=new ArrayList< BasicDBObject>(list.size());
for(int i = 0 ; i < list.size(); i++) {
updateCondition.get(i).put("md5", list.get(i));
DBObject updatedValue=new BasicDBObject();
updatedValue.put("download", 0);
DBObject updateSetValue=new BasicDBObject("$set",updatedValue);
vt_col.update(updateCondition.get(i), updateSetValue);
}
The exception is occuring at :
updateCondition.get(i).put("md5", list.get(i));
I want your help, thanks for helping me.