SetData don't create valide entry on the database, can't query inserted object

Hello,

I’m using Couchbase as internal database to store object received from an API. I convert Json document to Dictionnary<string, object> and use the method setData, but when I ask document listing, for a specific document, the only keys available are _id and my-db.

It seems that

mutableDocument.SetString("key", "value")

and

mutableDocument.SetData(new Dictionary<string, object>() {{"key", "value"}})

not produce same inner database document.

How to query a disctionnary ? by exemple to only have document with key = “DEMO” ?

PS: This is an exemple, currently, we save some entity with more that 100 attributes, we can’t manually use SetString, SetFloat, … when we save entity into database

SetData replaces the entire document with the given dictionary, while SetString just updates one property. So yes, if the document previously contained any properties other than key, those two calls will have different results.

How to query a disctionnary ? by exemple to only have document with key = “DEMO” ?

Sorry, I don’t understand the question. You’re asking how to create a query that returns the documents where the value of key is DEMO? That’s pretty simple, and our documentation shows equivalent examples. Or are you asking something more complex?