[JAVA-2646] ChangeStreamDocument missing _id information on delete operation Created: 27/Oct/17  Updated: 29/Oct/17  Resolved: 28/Oct/17

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 3.6.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Wan Bachtiar Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-2632 Add documentKey property to ChangeStr... Closed
Related

 Description   

mongo-java-driver version 3.6.0-beta2

Following the draft tutorial from
http://mongodb.github.io/mongo-java-driver/3.6/driver/tutorials/change-streams/

It can be observed that ChangeStreamDocument is missing the value of _id information for delete operation.

An example output using MongoDB Java driver when watching for a delete action:

ChangeStreamOutput{resumeToken={ "_data" : { "$binary" : "glnyzgsAAAABRmRfaWQAZFnyx9Kt2EoTEfEpngBaEATdDjimqgNN+5iz/fXo8WsLBA==", "$type" : "00" } }, namespace=test.restaurants, fullDocument=null, operationType=OperationType{value='delete'}, updateDescription=null}

The same output in mongo shell:

{
	"_id" : {
		"_data" : BinData(0,"glnyzgsAAAABRmRfaWQAZFnyx9Kt2EoTEfEpngBaEATdDjimqgNN+5iz/fXo8WsLBA==")
	},
	"operationType" : "delete",
	"ns" : {
		"db" : "test",
		"coll" : "restaurants"
	},
	"documentKey" : {
		"_id" : ObjectId("59f2c7d2add84a1311f1299e")
	}
}

Using MongoDB Python driver (master/unreleased)

 
{u'documentKey': {u'_id': ObjectId('59f2c7d2add84a1311f1299e')}, u'_id': RawBSONDocument('B\x00\x00\x00\x05_data\x001\x00\x00\x00\x00\x82Y\xf2\xce\x0b\x00\x00\x00\x01Fd_id\x00dY\xf2\xc7\xd2\xad\xd8J\x13\x11\xf1)\x9e\x00Z\x10\x04\xdd\x0e8\xa6\xaa\x03M\xfb\x98\xb3\xfd\xf5\xe8\xf1k\x0b\x04\x00', codec_options=CodecOptions(document_class=<class 'bson.raw_bson.RawBSONDocument'>, tz_aware=False, uuid_representation=PYTHON_LEGACY, unicode_decode_error_handler='strict', tzinfo=None)), u'ns': {u'coll': u'restaurants', u'db': u'test'}, u'operationType': u'delete'}

Perhaps this is because _id information is included in fullDocument section for insert, update, replace but for delete fullDocument is null. Adding documentKey as a property of ChangeStreamDocument may solve this issue.



 Comments   
Comment by Jeffrey Yemin [ 28/Oct/17 ]

Closing as duplicate. Let me know if you disagree and we'll reevaluate.

Comment by Jeffrey Yemin [ 27/Oct/17 ]

This looks like a duplicate of JAVA-2632.

Generated at Thu Feb 08 08:57:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.