MongoDB
 sql >> Datenbank >  >> NoSQL >> MongoDB

Ember-Datenhierarchie mit mehreren Ebenen mit immer eingebettet

In Ember-Rails sind noch einige Fehlerbehebungen vorhanden:Wir haben unter der Funktion gelitten

extractEmbeddedBelongsTo: function(loader, relationship, data, parent, prematerialized)     {
var reference = this.extractRecordRepresentation(loader, relationship.type, data, true);
prematerialized[relationship.key] = reference;

// If the embedded record should also be saved back when serializing the parent,
// make sure we set its parent since it will not have an ID.
var embeddedType = this.embeddedType(parent.type, relationship.key);
if (embeddedType === 'always') {
  reference.parent = parent;
}

}

Die Relation BelongsTo überspringt die Extraktion von eingebetteten Objekten. Das falsche ist hier:

extractEmbeddedBelongsTo: function(loader, relationship, data, parent, prematerialized) {
var reference = loader.sideload(relationship.type, data);
prematerialized[relationship.key] = reference;

// If the embedded record should also be saved back when serializing the parent,
// make sure we set its parent since it will not have an ID.
var embeddedType = this.embeddedType(parent.type, relationship.key);
if (embeddedType === 'always') {
  reference.parent = parent;
}

}