*
* @see Writable#readFields(DataInput)
*/
public void readFields(final DataInput in) throws IOException {
BSONDecoder dec = new BasicBSONDecoder();
BSONCallback cb = new BasicBSONCallback();
// Read the BSON length from the start of the record
byte[] l = new byte[4];
try {
in.readFully(l);
int dataLen = Bits.readInt(l);
byte[] data = new byte[dataLen + 4];
System.arraycopy(l, 0, data, 0, 4);
in.readFully(data, 4, dataLen - 4);
dec.decode(data, cb);
query = (BasicBSONObject) cb.get();
in.readFully(l);
dataLen = Bits.readInt(l);
data = new byte[dataLen + 4];
System.arraycopy(l, 0, data, 0, 4);
in.readFully(data, 4, dataLen - 4);
dec.decode(data, cb);
modifiers = (BasicBSONObject) cb.get();
upsert = in.readBoolean();
multiUpdate = in.readBoolean();
} catch (Exception e) {
/* If we can't read another length it's not an error, just return quietly. */
// TODO - Figure out how to gracefully mark this as an empty