const { Schema } = require(“ottoman”);
var schema = new Schema({
agentId: { type: String },
fname: { type: String },
lname: { type: String }
})
var schema = new Schema({
markupId: { type: String },
markupTitle: { type: String },
agent: [{ type: Agent, ref: “Agent” }]
});
schema.index.findByAgentIds = {
by: ‘agent[*].agentId’,
type: ‘refdoc’
};
module.exports = schema;
const result = await Markup.findByAgentIds(agents.id, options);
not get any data from the array. follow is the result which I got .
{
"cause": {
"code": 301
},
"context": {
"status_code": 1,
"opaque": 2,
"cas": "0",
"key": "$_defaultAgentMarkup$agent[*]::agentId.587145ec-a498-4c21-9123-0b937a6906d6",
"bucket": "sampleTrucard",
"collection": "",
"scope": "",
"context": "",
"ref": ""
}
}
please give me a suggestion, how I get data from the array index,