0
votes

I only just removed the autopublish and insecure packages, so from my understanding I had to define my mongodb, publish them server side and subscribe on client only to those db's i want accessed client side. So I did

Server

Users = new Mongo.Collection('users');

Meteor.publish('users', function(){
return Users.find();
});

Client

Meteor.subscribe('users');

I also started my db fresh, so I dropped both roles and users db from mongo cmd line. db.users.drop() etc

However, I was returned with

W20160726-11:19:13.986(8)? (STDERR)
W20160726-11:19:13.990(8)? (STDERR) C:\Users\Farhan\AppData\Local\.meteor\packages\meteor-tool\1.3.5_1\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:280
W20160726-11:19:13.993(8)? (STDERR)                                             throw(ex);
W20160726-11:19:13.996(8)? (STDERR)                                                   ^
W20160726-11:19:13.998(8)? (STDERR) Error: There is already a collection named "users"
W20160726-11:19:14.001(8)? (STDERR)     at new Mongo.Collection (packages/mongo/collection.js:244:15)
W20160726-11:19:14.004(8)? (STDERR)     at meteorInstall.server.main.js (server/main.js:2:9)
W20160726-11:19:14.007(8)? (STDERR)     at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
W20160726-11:19:14.012(8)? (STDERR)     at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
W20160726-11:19:14.015(8)? (STDERR)     at C:\Users\Farhan\csgofiyav1\.meteor\local\build\programs\server\app\app.js:100:1
W20160726-11:19:14.019(8)? (STDERR)     at C:\Users\Farhan\csgofiyav1\.meteor\local\build\programs\server\boot.js:297:10
W20160726-11:19:14.022(8)? (STDERR)     at Array.forEach (native)
W20160726-11:19:14.025(8)? (STDERR)     at Function._.each._.forEach

(C:\Users\Farhan\AppData\Local.meteor\packages\meteor-tool\1.3.5_1\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11) W20160726-11:19:14.029(8)? (STDERR) at C:\Users\Farhan\csgofiyav1.meteor\local\build\programs\server\boot.js:133:5

However, after that, I removed users = new Mongo... & roles and it worked. No errors returned. I'm left confused and now wondering if the security of the app has been compromised...

Any clarification and suggestions to prevent this from happening would be a life saver!

1

1 Answers

0
votes

Users is already a built-in collection. There is no need to publish or subscribe Users as it is already done by the framework.

Sometimes, it is required to customise the default publish behaviour of the Users collection. The Meteor guide explains this in detail.