This is a silly mistake I did..
Don't use
Arrays.sort(strs.toArray(new String[0]));
Instead use the following:
Collections.sort(strs);
Don't use
Arrays.sort(strs.toArray(new String[0]));
Instead use the following:
Collections.sort(strs);
This option specifies a time limit, in milliseconds, for the write concern. wtimeout is only applicable for w values greater than 1.
wtimeout causes write operations to return with an error after the specified limit, even if the required write concern will eventually succeed. When these write operations return, MongoDB does not undo successful data modifications performed before the write concern exceeded the wtimeout time limit.
If you do not specify the wtimeout option and the level of write concern is unachievable, the write operation will block indefinitely. Specifying a wtimeout value of 0 is equivalent to a write concern without the wtimeout option.
The maximum BSON document size is 16 megabytes.
Requiring journaled write concern in a replica set only requires a journal commit of the write operation to the primary of the set regardless of the level of replica acknowledged write concern.You can find more information on the official MongoDB docs and a relative StackOverflow post.