I am trying to understand nested loading as defined in: http://docs.sencha.com/extreact/6.5....sociation.html

However I can't seem to figure out how the models are supposed to be defined as per the example provided at the above link. The code provided is:

// Sample JSON data returned by /Users
[{
"id": 1,
"name": "User Foo",
"orders": [{
"id": 101,
"userId": 1
}, {
"id": 102,
"userId": 1
}, {
"id": 103,
"userId": 1
}]
}, {
"id": 2,
"name": "User Bar",
"orders": [{
"id": 201,
"userId": 2
}, {
"id": 202,
"userId": 2
}]
}]

// Application code
var users = new Ext.data.Store({
model: 'User',
proxy: {
type: 'ajax',
url: '/Users'
}
});
users.load(function() {
var user1 = users.first(),
user2 = users.last(),
orders1 = user1.orders(),
orders2 = user2.orders();

// 3 orders, same reference back to user1
console.log(orders1.getCount(), orders1.first().getUser() === user1);
// 2 orders, same reference back to user2
console.log(orders2.getCount(), orders2.first().getUser() === user2);
});
But there does not seem to be any indication as to how the models are defined.

If the model were as follows as per an example on the page:
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [{
name: 'id',
type: 'int'
}, 'name'],
hasMany: 'Order'
});
How does the nested data know that the models are in the orders property in the json? Will the above model work for above store?