Why the MutationToken in IDocumentResult when you using GetDocument it's always null?

Hi All,

I need to get the SequanceNumber from an existing document.

I found a method that return an IDocumentResult which has the property MutationToken but unfortunately it’s every time null.

Any helps on it??

Thanks

@supernerd89

Make sure you have Enhanced Durability enabled in your client SDK configuration. Without that MutationToken functionality isn’t available.

It’s already enabled the Enhanced Durability.

@supernerd89

As long as that configuration is making it through to the call to ClusterHelper.Initialize, that should do it (to my knowledge). Are you using Couchbase Server 4.5 or later? That’s the minimum version for MutationTokens.

Thanks for the reply, the version is 4.5.2.

@supernerd89

Okay, I’m starting to run out of ideas… Can you confirm your SDK version and the types of operations you’re performing where MutationToken is null? Sorry, I should have asked this before.

So the SDK version is 2.5.10 and the operation as you can see from the title of the topic is connection.Bucket.GetDocument().

@supernerd89

Okay, sorry I missed that. GetDocument should not have a value for MutationToken. MutationToken is returned on mutation operations only, i.e. Replace, Insert, Remove, Upsert, etc. The purpose of the token is for Read-Your-Own-Write functionality, where you can guarantee that a follow-on N1QL query includes the mutation you just performed.

You can see more details in the AtPlus section of this blog post: https://blog.couchbase.com/new-to-couchbase-4-5-atplus/

1 Like

Thanks @btburnett3 now it’s much more clear the behavior.

So basically if i’m not using an mutation operations i cannot get the MutationToken in anyways, right?

@supernerd89

Correct

1 Like