Я использую драйверы mongo java, как показано ниже:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-reactivestreams</artifactId>
<version>1.11.0</version>
</dependency>
Когда я определяю простой конвейер как:
List<Bson> pipeline = Arrays.asList(
Aggregates.project(Projections.fields(
Projections.computed("id", "$fullDocument._id")
))
);
collection.watch(pipeline).fullDocument(FullDocument.UPDATE_LOOKUP));
После выполнения некоторых операций CRUD я всегда получаю эти 'null 'output:
ChangeStreamDocument{resumeToken={"_data": "825C8B65510000000129295A1004E2034BD33C7D40DE92CB94E139C92CB146645F696400645C8B65511B2DF1941FD846250004"}, namespace=null, fullDocument=null, documentKey=null, clusterTime=null, operationType=null, updateDescription=null}
ChangeStreamDocument{resumeToken={"_data": "825C8B65510000000229295A1004E2034BD33C7D40DE92CB94E139C92CB146645F696400645C8B65511B2DF1941FD846250004"}, namespace=null, fullDocument=null, documentKey=null, clusterTime=null, operationType=null, updateDescription=null}
ChangeStreamDocument{resumeToken={"_data": "825C8B65560000000129295A1004E2034BD33C7D40DE92CB94E139C92CB146645F696400645C8B65511B2DF1941FD846250004"}, namespace=null, fullDocument=null, documentKey=null, clusterTime=null, operationType=null, updateDescription=null}
ChangeStreamDocument{resumeToken={"_data": "825C8B65560000000229295A1004E2034BD33C7D40DE92CB94E139C92CB146645F696400645C8B65511B2DF1941FD846250004"}, namespace=null, fullDocument=null, documentKey=null, clusterTime=null, operationType=null, updateDescription=null}
Did not it should be like :
{
"id": xxxxxxxxxx
}
Пожалуйста, исправьте меня.