Select data
You can use the select
prefilter to select specific data
In this example the content is selected on server side so that no overhead of unused data is created.
It is not possible to update selected values directly because information like primary keys get lost.
You can pass all parameters to the select function. The query will return you a two dimensional array of all object values.
If only one parameter is the array will be flat.
Note that the usage of the prefilter types
Take
, Skip
, Select
, Count
, First
and Last
will require the collection data to always get queried from the database on every change. Keep that in mind when creating performance critical tasks.
\f:(typescript:Angular) export class DemoComponent implements OnInit {\n \tvalues$: Observable<string[]>;\n \tconstructor(private db: SapphireDbService) { }\n\n \tngOnInit() {\n \t\tthis.values$ = this.db.collection<Entry>('entries')\n \t\t\t.select('content')\n \t\t\t.values();\n \t}\n }
null
\f:(typescript:Angular) export class DemoComponent implements OnInit {\n \tvalues$: Observable<string[]>;\n \tconstructor(private db: SapphireDbService) { }\n\n \tngOnInit() {\n \t\tthis.values$ = this.db.collection<Entry>('entries')\n \t\t\t.select('content', 'id')\n \t\t\t.values();\n \t}\n }
null