Код: Выделить всё
mongoOutputMono = Mono.from(database.runCommand(command));
JSONObject outputJson = new JSONObject(mongoOutput.toJson(documentCodec));
System.out.println("output json is " + outputJson);
Выходной файл JSON выглядит следующим образом
Код: Выделить всё
{
"electionId": { "$oid": "7fffffff0000000000000531" },
"$clusterTime": {
"clusterTime": { "$timestamp": { "t": 1714592831, "i": 31 } },
"signature": {
"keyId": 7327356439112974337,
"hash": {
"$binary": { "base64": "dDUDEwRppg/l9t2C4bOqzawPQ8M=", "subType": "00" }
}
}
},
"opTime": { "t": 1329, "ts": { "$timestamp": { "t": 1714592831, "i": 31 } } },
"ok": 1,
"n": 1,
"operationTime": { "$timestamp": { "t": 1714592831, "i": 31 } }
}
PS: я использую import com.mongodb.reactivestreams.client.MongoDatabase
Подробнее здесь: https://stackoverflow.com/questions/784 ... ctive-java