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

.net

#1

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


#2

@supernerd89

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


#3

It’s already enabled the Enhanced Durability.


#4

@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.


#5

Thanks for the reply, the version is 4.5.2.


#6

@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.


#7

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().


#8

@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/


#9

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?


#10

@supernerd89

Correct