meteor

Meteor MongoDB find / fetch issues

走远了吗. 提交于 2019-12-22 18:24:52
问题 Meteor.publish('polls', function () { return Polls.find({}); }); Meteor.publish('recentPolls', function() { return Polls.find({}, {sort: {date: -1}, limit: 10}).fetch(); }); So this is in my /server/server.js file from the documentation it says the fetch() method returns matched documents in an array. However, using the subscribe function in the client like so Template.recentPolls.polls = function() { console.log(Meteor.subscribe('recentPolls')); return Meteor.subscribe('recentPolls'); } For

How to execute a Python script from server side Javascript

你。 提交于 2019-12-22 18:13:15
问题 There are a number of answers in relation to how one can execute a Python script from the client side. I am interested in finding out if it is possible to execute the script from the server side and check if the execution has finished successfully. Let say that I'm using Meteor stack which uses JavaScript on both sides and there are a bunch of Python script tasks that needs to be triggered from backend. 回答1: If you need python scripts at you project the most common way is to connect python

How to focus a DOM child element from a Meteor event handler

时光怂恿深爱的人放手 提交于 2019-12-22 17:14:09
问题 I have an event handler that sets a session variable to change the content within a DOM element -- in this case a table cell. 'dblclick td.itemName': function (evt) { Session.set("editItemName",true); evt.currentTarget.children[0].focus(); }, <td class="itemName"> {{#unless editItemName}} {{name}} {{else}} <input class="editItemName" type="text" value="{{name}}" style="width:100px;"> {{/unless}} </td> Pretty straight forward... However evt.currentTarget.children doesnt work. Once the input

How to send a text from the user's cell phone number using Twilio?

心已入冬 提交于 2019-12-22 16:30:10
问题 I want to programatically send SMS / text messages from my Meteor app; many people recommend twilio for this, and there are several Meteor Twilio packages (findable via atmosphere and/or googling/binging). I don't know if one of these packages is decidedly better than the other, but for now, at least, I'm using the abhiaayer:meteor-twilio package. My concern is that, when you create a Twilio account, they assign you a "from" phone number (you can't, apparently, just use your own). Maybe I'm

Using modules in Meteor.js with Typescript

家住魔仙堡 提交于 2019-12-22 14:57:15
问题 Folks, I'm trying to do something that I thought ought to be simple, but I must be doing something wrong. I'm trying to simply have a clear structure in my meteor application which uses Typescript. Here are my requirements: All interfaces are available in both client and server Some class implementations are only available on the server I don't want to rely on file load order for my application to work properly I need my own module to not clash with global objects (such as the Position class

Calling a Meteor Method inside a Promise Callback [Halting w/o Error]

ぐ巨炮叔叔 提交于 2019-12-22 14:51:19
问题 I'm trying to use this NPM package: Gumroad-API inside my Meteor app. I'm encountering issues on the server side when I try to do a Meteor method call (or a collection insert) inside of the Promise callback. The following is the code for my two Meteor methods: Meteor.methods({ testMethod: () => { console.log('TEST METHOD RUN'); }, fetchGumroadData: () => { const Gumroad = Meteor.npmRequire('gumroad-api'); let gumroad = new Gumroad({ token: Meteor.settings.gumroadAccessKey }); Meteor.call(

Calling a Meteor Method inside a Promise Callback [Halting w/o Error]

孤人 提交于 2019-12-22 14:50:07
问题 I'm trying to use this NPM package: Gumroad-API inside my Meteor app. I'm encountering issues on the server side when I try to do a Meteor method call (or a collection insert) inside of the Promise callback. The following is the code for my two Meteor methods: Meteor.methods({ testMethod: () => { console.log('TEST METHOD RUN'); }, fetchGumroadData: () => { const Gumroad = Meteor.npmRequire('gumroad-api'); let gumroad = new Gumroad({ token: Meteor.settings.gumroadAccessKey }); Meteor.call(

Convert string to Mongo ObjectID in Javascript (Meteor)

谁说我不能喝 提交于 2019-12-22 12:01:25
问题 I have a Meteor application whereby I initially use the _id field from each record in my collection when naming list items in my template. When get the _id field, I convert it to a string to use in the template. Now I want to update these records in Mongo and am passing the _id back to a Meteor.method , but these are still in string format and Mongo is expecting an ObjectID(). Is there a simple way to convert this string to the ObjectID() ? If not, what alternatives do I have? 回答1: Ok, found

Segmented Meteor App(s) - loading only half the client or two apps sharing a database

可紊 提交于 2019-12-22 11:33:59
问题 I understand the security model of publish and subscribe. But I'm working on a somewhat large application, of which perhaps 70% will be admin only, restricted to less than 1% of the user base. It seems horrible to send all the templates, css, and extra javascript and "add ons" (like wysiwyg editor) which are only going to be used by the admins, to all app users. Is there a way to only send clientside stuff to certain users (or only when the user triggers a different "section"? If not, i think

fs.readFileSync is not a function Meteor, React

一曲冷凌霜 提交于 2019-12-22 11:13:12
问题 I'm getting a 'fs.readFileSync is not a function' in Chrome debugger after trying to call readFileSync(); I call it... const fs = require('fs'); call the function... let content = fs.readFileSync('/path/to/my/file.stuff'); And attempt to display content.. console.log(content); I get nothing. When I do... console.log(fs); I appear to get a generic javascript object... I'm completely stuck. Meteor version: 1.5.1 npm version: 3.10.10 node version: v6.10.1 回答1: Thanks for all the answers! I have