不要怂,就是干,撸起袖子干!

Commit ebccfefc by Sascha Depold

extended example with find and findall

1 parent 9107d5e2
Showing with 9 additions and 1 deletions
......@@ -19,9 +19,17 @@ Sequelize.chainQueries([{drop: sequelize}, {sync: sequelize}], function() {
person.setPets([pet], function(pets) {
console.log('my pet: ' + pets[0].name )
console.log("Now let's get the same data with loadAssociatedData!")
person.loadAssociatedData(function(data) {
person.fetchAssociations(function(data) {
Sequelize.Helper.log("And here we are: " + data.pets[0].name)
Sequelize.Helper.log("The object should now also contain the data: " + person.associatedData.pets[0].name)
Person.find(person.id, { fetchAssociations: true }, function(p) {
Sequelize.Helper.log(p)
})
Person.findAll({ fetchAssociations: true }, function(people) {
Sequelize.Helper.log(people)
})
})
})
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!