As per the doc N1QL REST API | Couchbase Docs
readOnly options is used to stop user from executing data manipulation queries
But when i try to use the same with nodejs SDK the below code executes the insert query and does not throw any error
But when i try the same using REST API below it works as expected
Let me know how can i achieve the same with Nodejs sdk
Thanks
Desh Naik
Hello @desh_naik which version of Node sdk are you using ?
HI @AV25242 i am using 4.1 version
Hello @desh_naik , this looks like an issue . I have created a ticket to track this
https://issues.couchbase.com/browse/JSCBC-1089
thanks for reporting this, we will try to fix this as soon as possible.
HI @AV25242 thank you. We are trying to use this feature on our production … so if possible can i please know by when i can expect the fix to be done ?
vsr1
July 29, 2022, 12:55pm
6
See if Node.js allows to set options via raw interface (I am not expert). If allows set readonly via that and see if that works.
Example: .NET client has this option QueryOptions.Raw Method
QueryOptions (Couchbase Java SDK 3.3.2 API) raw()
HI @vsr1 i tried with raw option too but still it does not work … anyway thank you for the suggestion
Hi @desh_naik
I looked into the issue and the server does not honour the readonly option in prepared queries. Because of a bug in the SDK (Loading... ), all queries are prepared. Until this is fixed, you can workaround it by explicitly setting ahoc to true in the query options.
const options = { readOnly: true, adhoc: true }
2 Likes
@desh_naik that seems to be right, I verified it as well can you use this as a workaround in the meanwhile ?
1 Like
thank you so much @jrawsthorne @AV25242 really appreciate the quick solution an response