Mongodb 错误:名为'/用户/插入';已定义
我刚刚安装了帐户google和帐户ui软件包,发现错误:Mongodb 错误:名为'/用户/插入';已定义,mongodb,meteor,Mongodb,Meteor,我刚刚安装了帐户google和帐户ui软件包,发现错误: W20150525-10:41:42.384(1)? (STDERR) W20150525-10:41:42.384(1)? (STDERR) /home/andy/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/no
W20150525-10:41:42.384(1)? (STDERR)
W20150525-10:41:42.384(1)? (STDERR) /home/andy/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150525-10:41:42.384(1)? (STDERR) throw(ex);
W20150525-10:41:42.384(1)? (STDERR) ^
W20150525-10:41:42.449(1)? (STDERR) Error: A method named '/users/insert' is already defined
W20150525-10:41:42.449(1)? (STDERR) at packages/ddp/livedata_server.js:1461:1
W20150525-10:41:42.449(1)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
W20150525-10:41:42.449(1)? (STDERR) at [object Object]._.extend.methods (packages/ddp/livedata_server.js:1459:1)
W20150525-10:41:42.449(1)? (STDERR) at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:904:1)
W20150525-10:41:42.449(1)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:209:1)
W20150525-10:41:42.449(1)? (STDERR) at app/meteor.js:1:44
W20150525-10:41:42.449(1)? (STDERR) at app/meteor.js:16:3
W20150525-10:41:42.450(1)? (STDERR) at /home/andy/dev/meteor/.meteor/local/build/programs/server/boot.js:222:10
W20150525-10:41:42.450(1)? (STDERR) at Array.forEach (native)
W20150525-10:41:42.450(1)? (STDERR) at Function._.each._.forEach (/home/andy/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
=> Exited with code: 8
我的代码目前非常简单(非常新!)。下面是meteor.html:
<head>
<title>Hubbub</title>
</head>
<body style="padding-top: 100px;">
<div class="container">
<div class="row">
<div class="col-xs-12">
{{> loginButtons}}
{{> main }}
</div>
</div>
</div>
</body>
<template name="main">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>age</th>
<th>date</th>
</tr>
</thead>
<tbody>
{{#each users}}
<tr>
<td>{{_id}}</td>
<td>{{name}}</td>
<td>{{age}}</td>
<td>{{date}}</td>
</tr>
{{/each}}
</tbody>
</table>
</template>
我做错了什么?也许您的代码与Meteor default
用户的收藏冲突
你不需要定义一个Mongo.Collection
来处理你的应用程序用户,Meteor自带一个名为Meteor的烘焙集合。用户
,使用它,或者将你的集合重命名为其他集合。如何使用Meteor.users更新用户文档?
Users = new Mongo.Collection('users');
if (Meteor.isClient) {
Template.main.helpers({
users: function() {
return Users.find();
},
date: function(){
return moment(this.date).fromNow();
}
});
}