houston icon indicating copy to clipboard operation
houston copied to clipboard

How do I add Houston admins in server?

Open jdmswong opened this issue 9 years ago • 1 comments

How do I add adminId as a Houston admin?

I have tried 3 options in Meteor.startup(), which have all thrown errors:

Option 1:

Meteor.collection("houston_admins").insert({"user_id": adminId});

Throws:

W20150818-13:40:06.974(-7)? (STDERR)
W20150818-13:40:06.974(-7)? (STDERR) C:\Users\JD\AppData\Local\.meteor\packages\
meteor-tool\1.1.4\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers
\future.js:245
W20150818-13:40:06.975(-7)? (STDERR)
throw(ex);
W20150818-13:40:06.975(-7)? (STDERR)
      ^
W20150818-13:40:06.976(-7)? (STDERR) TypeError: Object #<Object> has no method '
collection'
W20150818-13:40:06.976(-7)? (STDERR)     at app\server\startup.js:17:10
W20150818-13:40:06.976(-7)? (STDERR)     at C:\Users\JD\Desktop\sandbox\monarch\
www\meteor\.meteor\local\build\programs\server\boot.js:229:5

Options 2 and 3:

Houston._admins.insert({"user_id": adminId});   
HoustonAdmins = new Mongo.Collection("houston_admins");
HoustonAdmins.insert({"user_id": adminId});     

both throw the same error:

W20150818-13:27:25.023(-7)? (STDERR)
W20150818-13:27:25.023(-7)? (STDERR) C:\Users\JD\AppData\Local\.meteor\packages\
meteor-tool\1.1.4\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers
\future.js:245
W20150818-13:27:25.024(-7)? (STDERR)
throw(ex);
W20150818-13:27:25.024(-7)? (STDERR)
      ^
W20150818-13:27:25.024(-7)? (STDERR) Error: A method named '/houston_admins/inse
rt' is already defined
W20150818-13:27:25.025(-7)? (STDERR)     at packages/ddp/livedata_server.js:1461
:1
W20150818-13:27:25.025(-7)? (STDERR)     at Function._.each._.forEach (packages/
underscore/underscore.js:113:1)
W20150818-13:27:25.026(-7)? (STDERR)     at [object Object]._.extend.methods (pa
ckages/ddp/livedata_server.js:1459:1)
W20150818-13:27:25.026(-7)? (STDERR)     at [object Object].Mongo.Collection._de
fineMutationMethods (packages/mongo/collection.js:904:1)
W20150818-13:27:25.026(-7)? (STDERR)     at [object Object].Mongo.Collection (pa
ckages/mongo/collection.js:209:1)
W20150818-13:27:25.027(-7)? (STDERR)     at new ns.Collection (packages/lai:coll
ection-extensions/collection-extensions.js:71:1)
W20150818-13:27:25.027(-7)? (STDERR)     at app\server\startup.js:19:19
W20150818-13:27:25.028(-7)? (STDERR)     at C:\Users\JD\Desktop\sandbox\monarch\
www\meteor\.meteor\local\build\programs\server\boot.js:229:5

I am new to meteor, what am I missing here? Thanks!

jdmswong avatar Aug 18 '15 20:08 jdmswong

You have a couple options.

One is to use the Houston interface and add a new admin.

The other is to add it from the server, similar to how you're trying to do it. You have to use a slightly different syntax though:

Houston._admins.insert({
  user_id: adminId
})

samcorcos avatar Aug 23 '15 13:08 samcorcos