@@ -20,12 +20,12 @@ By doing this the Collection gets automatically bound to the Agile Instance it w
20
20
const MY_COLLECTION = App .createCollection ();
21
21
```
22
22
There is also a way to use the plain ` Collection Class ` ,
23
- but there we have to pass the ` Agile Instance ` , to which the Collection should get bound, beside the config .
23
+ but there we have to pass the ` Agile Instance ` , to which the Collection should get bound.
24
24
``` ts
25
25
const MY_COLLECTION = new Collection (App );
26
26
```
27
27
Both instantiations lead to the same result, but we recommend using the former one.
28
- After we have successfully created our first Collection, we can start using its powerful tools of it .
28
+ After we have successfully created our first Collection, we can start using its powerful features .
29
29
``` ts
30
30
MY_COLLECTION .collect ({id: 1 , name: " jeff" }); // Add Item to Collection
31
31
MY_COLLECTION .remove (1 ).everywhere (); // Remove Item from Collection
@@ -38,12 +38,17 @@ MY_COLLECTION.collect({id: 1, name: "jeff"}).persist().removeGroup('myGroup').re
38
38
39
39
### 🔨 Usage
40
40
41
- We might use a Collection, if we want to have an array of Todo Objects or Posts Objects.
41
+ We might use a Collection, if we need a flexible array of Todo Objects.
42
42
``` ts
43
43
const TODOS = App .createCollection ();
44
- TODOS .collect ({id: 1 , todo: " Clean bathroom" });
45
- TODOS .collect ({id: 2 , todo: " Write Agile docs" });
44
+ TODOS .collect ({id: 1 , todo: " Clean bathroom" }, [" user1" , " todayTodos" ]);
45
+ TODOS .collect ({id: 2 , todo: " Write Agile docs" }, [" user1" ]);
46
+ // <- cleand bathroom
47
+ TODOS .remove (1 ).everywhere ();
46
48
```
49
+ Here we create a ` TODO ` Collection and add two todos to it, which both get stored in the ` user1 ` [ Group] ( ./group/Introduction.md ) .
50
+ Beside the ` user1 ` Group the todo with the id 1 gets also stored in the ` todayTodos ` Group.
51
+ After we have successfully cleaned our bathroom, we remove the todo related to the id 1.
47
52
48
53
### ⛳️ Sandbox
49
54
Test the Collection yourself, it's only one click away. Just select your preferred Framework below.
@@ -55,7 +60,7 @@ Test the Collection yourself, it's only one click away. Just select your preferr
55
60
56
61
Each Data Object we add to our Collection, for example with the ` collect ` method,
57
62
gets transformed to an Item. This Item than gets stored in our Collection.
58
- We can simply access each Item with the ` getItem ` method and the correct primary Key.
63
+ We can simply access each Item with the ` getItem ` method and the fitting ` primary Key ` .
59
64
``` ts
60
65
MY_COLLECTION .getItem (/* primary Key */ ); // Returns Item at the primary Key
61
66
```
0 commit comments