defineCollectionfunction
import { defineCollection } from '@mortar-kit/core'
function defineCollection<F extends Readonly<Record<string, AnyField>>>(def: CollectionDefinition<F>): Collection<F>Registers a collection.
Parameters
def: CollectionDefinition<F>
Returns
Collection<F>
Example
export const posts = defineCollection({
name: 'posts',
label: 'Posts',
fields: { title: fields.text({ label: 'Title', required: true }), date: fields.date({ label: 'Date' }) },
body: true,
sort: { field: 'date', order: 'desc' },
});