import { Mongo } from 'meteor/mongo'; const Items = new Mongo.Collection('items'); const itemSchema = new SimpleSchema({ name: { type: String, label: 'Name', max: 200, }, price: { type: Number, label: 'Price', min: 0, }, }); Items.attachSchema(itemSchema);
import { Mongo } from 'meteor/mongo'; const Users = new Mongo.Collection('users'); const userSchema = new SimpleSchema({ firstName: { type: String, label: 'First name', }, lastName: { type: String, label: 'Last name', }, email: { type: String, label: 'Email', regEx: SimpleSchema.RegEx.Email, }, age: { type: Number, label: 'Age', min: 1, max: 150, }, }); Users.attachSchema(userSchema);In this example, the `Users` collection is defined and a schema is attached to it using `attachSchema`. The schema defines the `firstName`, `lastName`, `email`, and `age` properties of each document in the collection. The `regEx` option is used to enforce that the `email` property is a valid email address. Package library: `aldeed:simple-schema`