【发布时间】:2015-07-16 07:40:29
【问题描述】:
我使用流星创建我的应用程序,并使用 MUP 将其部署在我自己的服务器中。这 部署成功,但数据库没有我的收藏。
我在文件lib/collections/name_collection.js 中定义了集合。这是文件的示例:
campaigns = new Mongo.Collection("campaigns");
campaigns.initEasySearch(['name','startDate','endDate']);
campaigns.newSchema=function(){
return new SimpleSchema({
name:{
type: String,
label: 'Nome'
},
startDate:{
type: 'datetime',
label: 'Data inizio'
},
endDate:{
type: 'datetime',
label: 'Data fine'
}
});
};
campaigns.editSchema=function(){
return new SimpleSchema({
c_id:{
type: String,
label: 'id'
},
editName:{
type: String,
label: 'Nome'
},
editStartDate:{
type: 'datetime',
label: 'Data inizio'
},
editEndDate:{
type: 'datetime',
label: 'Data fine'
}
});
};
SimpleSchema.messages({
"required name": "Il [label] è richiesto",
"required startDate": "La [label] è richiesto",
"required endDate": "La [label] è richiesto"
});
campaigns.allow({
insert: function (userId, doc) {
// the user must be logged in, and the document must be owned by the user
return (userId && doc.user === userId);
},
update: function (userId, doc, fields, modifier) {
// can only change your own documents
return doc.user === userId;
},
remove: function (userId, doc) {
// can only remove your own documents
return doc.user === userId;
},
fetch: ['user']
});
campaigns.deny({
update: function (userId, docs, fields, modifier) {
// can't change owners
return _.contains(fields, 'owner');
}
});
和 mup.json 文件:
{
// Server authentication info
"servers": [
{
"host": "168.235.151.xxx",
"username": "dvterritorg", // develop user
"password": "xxxxxx"
// or pem file (ssh based authentication)
//"pem": "~/.ssh/id_rsa"
}
],
// Install MongoDB in the server, does not destroy local MongoDB on future setup
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
"nodeVersion": "0.10.36",
// Install PhantomJS in the server
"setupPhantom": true,
// Application name (No spaces)
"appName": "dvterritorg",
// Location of app (local directory)
"app": ".",
// Configure environment
"env": {
"ROOT_URL": "http://dv.xxxxxx.it",
//"MONGO_URL": "mongodb://dvterritorg:xxxxxx@127.0.0.1/dvterritorg",
"METEOR_ENV": "production"
},
// Meteor Up checks if the app comes online just after the deployment
// before mup checks that, it will wait for no. of seconds configured below
"deployCheckWaitTime": 60
}
我尝试在meteor.com 和compose.io 中进行部署,但结果是一样的。
你能帮帮我吗?
【问题讨论】:
标签: javascript mongodb deployment collections meteor