// Create a new instance of Mongo.Collection with name 'tasks' const Tasks = new Mongo.Collection('tasks'); // Insert a new task into the collection Tasks.insert({ text: 'Learn Meteor', createdAt: new Date(), });
// Create a new instance of Mongo.Collection with name 'students' const Students = new Mongo.Collection('students'); // Insert multiple documents into the collection Students.insert([ { name: 'Alice', grade: 'A+' }, { name: 'Bob', grade: 'B' }, { name: 'Charlie', grade: 'C' }, ]);In this example, we create a new 'Students' collection and insert multiple documents into it. The documents are represented as an array of objects. The 'mongo' package is a core package in Meteor and is included by default in every Meteor application.