AT_PLUS Consistency Level in PHP SDK?

Hello folks! This is my first post to this forum.

I am trying to play around with the various scan consistency levels in N1QL queries. I am using the PHP SDK to make my queries against couchbase 4.5.1 (community edition).

In reviewing the SDK documentation for the N1QLQuery class, I see that it has an enum that include 3 possible values (‘request_plus’, ‘statement_plus’, and ‘not_bounded’). The “AT_PLUS” consistency option seems to be missing, and indeed when I try to use it I get the fatal error: “Undefined class constant ‘AT_PLUS’”.

So my question is: Is AT_PLUS scan consistency level supported in the PHP SDK, and if so, can anyone direct me to some further guidance on how to use it?

Thank you

Dylan

AT_PLUS consistency does not really need any flag or switch as it isn’t boolean option.

You should read docs on consistentWith(): http://docs.couchbase.com/sdk-api/couchbase-php-client-2.4.2/classes/Couchbase.N1qlQuery.html#method_consistentWith

Also there is an example in dev guides:

Thanks for this guidance, avsej. I will let you know how it goes.

Dylan

Thanks for your help on this. I was able to get it working and experiment with it a bit, in order to determine if it’s something that will be helpful for us.

May I ask one more question about this? In this example the mutation state is derived from the result of an upsert query, and the SELECT query needs to use this mutation state in the consistentWith method. So, does this mean that if I am doing lots of upserts and lots of selects, that I must store off the mutationState values for all my upserts and somehow connect them up with my Selects such that they can be fed in as parameters to the corresponding select query? That seems like a lot of work. Am I wrong?

The whole idea of at_plus is about collecting state and passing it with query. If you don’t want to deal with collecting state on the client side, you can ask server to do it with request_plus or statement_plus.

Thanks, avsej. This has been very helpful.