我有一组约会,我将其移植到新的1.3文件结构中。它的结构类似于Todo应用程序,但它仍然没有创建Meteor集合。
/imports/api/appointments/appointments.js
import { Meteor } from 'meteor/meteor';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Mongo } from 'meteor/mongo';
export const Appointments = new Mongo.Collection('appointments');
Appointments.deny({
insert() { return true; },
update() { return true; },
remove() { return true; },
});
/imports/startup/server/index.js
import './register-api.js';
/imports/startup/server/register-api.js
import '../../api/appointments/methods.js';
import '../../api/appointments/appointments.js';
import '../../api/orgs/orgs.js';
然后,使用" meteor mongo"和"显示集合"
availability
emailvariables
invitations
meteor_accounts_loginServiceConfiguration
orgs
recurring
roles
services
system.indexes
users
我做错了什么?
答案 0 :(得分:2)
new Mongo.Collection
不会自动创建MongoDB集合。您需要执行insert
才能创建它。像这样:
Meteor.startup(() => {
Appointments.insert({foo: 1});
});