我无法使用 ottomanJS 使用数组子文档字段进行查询,而且我找不到任何用于为数组子文档构建查询的文档,我们将不胜感激。
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);