meteor

Proper way to add field to the user collection in meteor

做~自己de王妃 提交于 2019-12-22 00:27:16
问题 So I'm trying to add an 'account_type' field to the user collection. Meteor.startup(function () { if (Meteor.users.find().count() === 0){ var user = Accounts.createUser({ email: 'email@fake.com', password: 'password' }); Meteor.users.update({_id: user}, {$set : {account_type: 'admin'}}); } }); When I call Meteor.user().account_type , it's undefined. I also read somewhere that something like this may be necessary: Meteor.methods({ get_user: function(user_id){ return Meteor.users().find({ _id:

Log in to a meteor app from a Google chrome extension

老子叫甜甜 提交于 2019-12-21 23:41:45
问题 I have a meteor app that uses restop2 package to allow posting data. The restop2 package provides a way to log in by sending user / password to a specific URL : curl --data "password=PASSWORD&user=USERNAME" http://localhost:3000/api/login/ It returns a JSON response containing a user ID and an access token : {"loginToken":"TOKEN","userId":"USERID","success":true} I can then post to the api by sending the user ID and the access token in the header : curl -X POST -H "X-Login-Token: TOKEN" -H "X

Meteor select element setting selected value

自古美人都是妖i 提交于 2019-12-21 23:23:36
问题 Inside my Meteor js app I have the select element shown below inside a form where I need to check and display selected value upon loading the form, I tried researching on how to do so in Meteor but couldn't find any info, so can someone please tell me how I can check which of the options is selected to make this option as a selected option? Thanks for your help <select name="memberType" class="form-control"> <option value="Member">Member</option> <option value="Admin">Admin</option> <option

Meteor.userId vs Meteor.userId()

帅比萌擦擦* 提交于 2019-12-21 23:11:44
问题 I have a short piece of code, like so, to update the name in my user's profile: Meteor.users.update({_id: Meteor.userId()}, {$set:{"profile.name": name}}); When I'm working locally, I can use Meteor.userId or Meteor.userId() without issue. However, when I deploy to Modulus, I run into issues. If I don't have the operator on it, it will do the initial $set, but no more. If I user the operators, it behaves as I would expect. Why is this? I assume that I shouldn't have been using this without

How to redirect users with unverified emails using Angular UI-Router?

旧城冷巷雨未停 提交于 2019-12-21 22:41:46
问题 I am using AngularJS with Meteor and wanted to redirect users with unverified emails to the sign in page. I have created a sign in view in /client/routes.js : app.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider){ $urlRouterProvider.otherwise('/'); $stateProvider .state('signin', { url:'/signin', views: { main: { templateUrl: 'client/views/profile/signin.tpl' } } }) Note that there are other states I am not listing for brevity sake. Now, I want to

Server side rendering with Meteor and Meteorhacks:ssr and iron-router

陌路散爱 提交于 2019-12-21 21:54:07
问题 This came out recently: https://meteorhacks.com/server-side-rendering.html but there doesn't seem to be a full fledged example of how to use this with iron-router. If I had a template like: /private/post_page.html {{title}} {{#markdown}} {{body}} {{/markdown}} How would I populate it with a single records attributes from a request for a specific ID ? E.g page requested was localhost:3000/p/:idofposthere how to populate it with data and render it in iron-router for that route / server side?

Meteor for non-internet mobile app

前提是你 提交于 2019-12-21 21:37:56
问题 I am developing a mobile app for iOS, Android, Windows mobile in Javascript and try to select in between Meteor and Backbone. The app will not include internet connectivity functionality. This app needs to store data on the device, not on a remote server. I am a newbie in Meteor and have some experience with Backbone, and I am a developer with a strong inclination to having a one tool, ok least minimum number of tools, for deploying to every platform. I need to write my app in a single code

Sessions in Meteor

本小妞迷上赌 提交于 2019-12-21 21:04:53
问题 After a research it seems that Meteor Sessions are reset after refreshing page or opening the website in new tab, i.e. they are not usual server-side sessions but something like global javascript variables on client-side. Some people advice to use AmplifyJS, but I'm not sure that it will work like usual session in other frameworks/languages and also it is a third party library, so is there any normal way to use sessions in Meteor, i.e. keep user-specific data on server? At this moment I'm

How can I synchronize a production meteor js database with development?

不想你离开。 提交于 2019-12-21 20:36:38
问题 I'm just getting into Meteor, and am similarly new to MongoDB. I am accustomed to syncing MySQL dbs (production vs dev) for running tests of new features with near-live data. At present, I don't know how to do this with meteor. From this (http://docs.meteor.com/#meteormongo) I gather that I can use a mongoDB shell to work with my local db, but from looking at http://docs.mongodb.org/manual/mongo/, I haven't yet figured out if this is the path I should be following to sync things up for Meteor

Correctly using collections in a meteor package?

烈酒焚心 提交于 2019-12-21 20:34:16
问题 I am trying to create a package that uses a collection. In a normal application, the same code works fine without any issues. collectiontest.js (Package code) // Why do I need to set the global property manually? var globals = this || window; TestCol = new Meteor.Collection('test'); globals.TestCol = TestCol; console.log('defined'); if(Meteor.isServer){ Meteor.publish('test', function(){ return TestCol.find(); }); Meteor.startup(function(){ console.log('wtf'); TestCol.remove({}); TestCol