-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
The list object returned by calling the toArray() function is not modifiable.
E.g.
Collections.sort(values, myCustomSorter);
List<DBObject> values = cursor.toArray();
Causes an unsupported operation exception:
Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableList$1.set(Collections.java:1186)
at java.util.Collections.sort(Collections.java:163)
The source for DBCursor shows:
Collections.unmodifiableList( _all );
Why is this list unmodifiable? I want to sot my data in the application layer instead of taxing Mongo with this.