Я пытаюсь заполнить массив идентификаторов из другой коллекции
Моя JsonSchema выглядит так:
{
version: 0,
type: "object",
properties: {
id: {
type: "string",
primary: true
},
// This is populated as expected
working: {
type: "array",
ref: "othercollection",
items: {
type: "string"
}
},
// This is where I am having problems
notWorking: {
type: "array",
items: {
type: "object",
properties: {
// This property is not being populated
problem: {
type: "array",
ref: "yetanothercollection",
items: {
type: "string"
}
}
}
}
}
}
}
Из документов на https://pubkey.github.io/rxdb/population.html Я должен быть в состоянииto:
Пример с вложенной ссылкой
const myCollection = await myDatabase.collection({
name: 'human',
schema: {
version: 0,
type: 'object',
properties: {
name: {
type: 'string'
},
family: {
type: 'object',
properties: {
mother: {
type: 'string',
ref: 'human'
}
}
}
}
}
});
const mother = await myDocument.family.mother_;
console.dir(mother); //> RxDocument
Пример с массивом
const myCollection = await myDatabase.collection({
name: 'human',
schema: {
version: 0,
type: 'object',
properties: {
name: {
type: 'string'
},
friends: {
type: 'array',
ref: 'human',
items: {
type: 'string'
}
}
}
}
});
//[insert other humans here]
await myCollection.insert({
name: 'Alice',
friends: [
'Bob',
'Carol',
'Dave'
]
});
const doc = await humansCollection.findOne('Alice').exec();
const friends = await myDocument.friends_;
console.dir(friends); //> Array.<RxDocument>
Поэтому мой вопрос: почему я не могу получить доступ к myDocument.notWorking[0].problem_
?
Вот снимок экрана консоли, который может дать вам лучшее понимание моей ситуации:

Как вы можете видеть свойство ingredients
не заполнены данными из коллекции ингредиентов (не на рисунке).Однако свойство taxes
заполняется.