private static Date getLastWriteDate(final BsonDocument isMasterResult) { if (!isMasterResult.containsKey("lastWrite")) { return null; } return new Date(isMasterResult.getDocument("lastWrite").getDateTime("lastWriteDate").getValue()); }
@Override public GridFSFile decode(final BsonReader reader, final DecoderContext decoderContext) { BsonDocument bsonDocument = bsonDocumentCodec.decode(reader, decoderContext); BsonValue id = bsonDocument.get("_id"); String filename = bsonDocument.get("filename", new BsonString("")).asString().getValue(); long length = bsonDocument.getNumber("length").longValue(); int chunkSize = bsonDocument.getNumber("chunkSize").intValue(); Date uploadDate = new Date(bsonDocument.getDateTime("uploadDate").getValue()); String md5 = bsonDocument.containsKey("md5") ? bsonDocument.getString("md5").getValue() : null; BsonDocument metadataBsonDocument = bsonDocument.getDocument("metadata", new BsonDocument()); Document optionalMetadata = asDocumentOrNull(metadataBsonDocument); for (String key : VALID_FIELDS) { bsonDocument.remove(key); } Document deprecatedExtraElements = asDocumentOrNull(bsonDocument); return new GridFSFile(id, filename, length, chunkSize, uploadDate, md5, optionalMetadata, deprecatedExtraElements); }
private static Date localTimeFrom(ServerHeartbeatSucceededEvent event) { BsonDocument reply = event.getReply(); return new Date(reply.getDateTime("localTime").getValue()); }
private static Date localTimeFrom(ServerHeartbeatSucceededEvent event) { BsonDocument reply = event.getReply(); return new Date(reply.getDateTime("localTime").getValue()); }
private static Date getLastWriteDate(final BsonDocument isMasterResult) { if (!isMasterResult.containsKey("lastWrite")) { return null; } return new Date(isMasterResult.getDocument("lastWrite").getDateTime("lastWriteDate").getValue()); }
private static Date lastWriteFrom(ServerHeartbeatSucceededEvent event) { BsonDocument reply = event.getReply(); if (!reply.containsKey("lastWrite")) { return null; } return new Date(reply.getDocument("lastWrite") .getDateTime("lastWriteDate").getValue()); } }
private static Date lastWriteFrom(ServerHeartbeatSucceededEvent event) { BsonDocument reply = event.getReply(); if (!reply.containsKey("lastWrite")) { return null; } return new Date(reply.getDocument("lastWrite") .getDateTime("lastWriteDate").getValue()); } }
@Override public GridFSFile decode(final BsonReader reader, final DecoderContext decoderContext) { BsonDocument bsonDocument = bsonDocumentCodec.decode(reader, decoderContext); BsonValue id = bsonDocument.get("_id"); String filename = bsonDocument.get("filename", new BsonString("")).asString().getValue(); long length = bsonDocument.getNumber("length").longValue(); int chunkSize = bsonDocument.getNumber("chunkSize").intValue(); Date uploadDate = new Date(bsonDocument.getDateTime("uploadDate").getValue()); String md5 = bsonDocument.containsKey("md5") ? bsonDocument.getString("md5").getValue() : null; BsonDocument metadataBsonDocument = bsonDocument.getDocument("metadata", new BsonDocument()); Document optionalMetadata = asDocumentOrNull(metadataBsonDocument); for (String key : VALID_FIELDS) { bsonDocument.remove(key); } Document deprecatedExtraElements = asDocumentOrNull(bsonDocument); return new GridFSFile(id, filename, length, chunkSize, uploadDate, md5, optionalMetadata, deprecatedExtraElements); }
.getDateTime(UpdateOneTimestampsStrategy.FIELDNAME_MODIFIED_TS); BsonDateTime insertedTS = updateDoc.getDocument("$setOnInsert") .getDateTime(UpdateOneTimestampsStrategy.FIELDNAME_INSERTED_TS);