I could't able to query using arrays sub-document field using ottomanJS and I cant find any documentation for query building for array sub-document, any help would be appreciated.
import { Schema, Query, getDefaultInstance } from "ottoman";
const TestSchema = new Schema({
block1:{
field1:{type: String, required: true},
field2:{type: String, required: true}
},
block2:[{
field3:{type: String, required: true},
field4:{type: String, required: true}
}]
})
const ottoman = getDefaultInstance();
const query = new Query({}, 'bucketName.scopeName.collectionName');
const where_exp = {block2[{field3}]:{$eq: 'xyz'}};
const result = query
.select()
.where(where_exp)
.build();
console.log(result);
};
Here is the answer I got from couchbase forum incase anyone still looking for