meteor

How can I pipe a command into the meteor shell?

孤街浪徒 提交于 2019-12-23 02:38:17
问题 Let's say I have a few directories, each running a different branch of a Meteor development server. I could cd to each directory, run meteor shell , and type a command. And that's great for 2 or 3 directories, but what if I have 10? 100? Is there some equivalent of meteor shell < 'DoJSThing()` that I can script from the command line, so that I can use [1] for d in ./*/ ; do (cd "$d" && meteor shell "doJSThing()" ); done [1] source for bash for loop 回答1: On the latest Meteor (I'm currently

Meteor: how do I return data from fields in a specific object?

流过昼夜 提交于 2019-12-23 02:30:57
问题 This should be a fairly simple one. myobject has various properties, _id, name, createdBy, date etc In my find query I want to only return specific fields from within myObject. So for example, what would I need to do to modify the find query below so that only name was returned? myCollection.find({createdBy: someId}, {fields: {myObject: 1}}).fetch(); Currently this will return everything in myObject which it should do, I just want one field within myObject returned. 回答1: Here is a way to do

Removing an object from an array inside a Collection

时光总嘲笑我的痴心妄想 提交于 2019-12-23 01:44:18
问题 I'm using the following methods to push and pull objects into the "following" array, which is a property on each user's profile. Meteor.users.update({ _id: this.userId }, { $push: { "profile.following": { _id: _id, service: service, type: type }} }); // I specify that it is required to match these two properties to remove an object Meteor.users.update({ _id: this.userId }, { $pull: { "profile.following": { service: service, type: type } } }); This approach does work, it removes the object,

How to set Meteor WebSocket port for clients?

落花浮王杯 提交于 2019-12-23 01:34:11
问题 How can I set the port WebSocket will be listening on? I'm trying to deploy Meteor on OpenShift, but there they have a nodejs-proxy server that listen on port 8000 instead 80, and redirect to my Meteor daemon. It is working since a manually created WebSocket object works fine. I've set ROOT_URL but without success. It appears on the browser as defined bellow: process.env.ROOT_URL = 'http://' + process.env.OPENSHIFT_APP_DNS + ':8000' I'm using this quickstart: https://github.com/openshift

Make REST API on Meteor+React without other packages

久未见 提交于 2019-12-23 01:29:13
问题 For example, when the path is /json/users/4 meteor app must return json something like { id: 4, name: 'Alex' } I'm using reactrouter:react-router for client routing. I know about reactrouter:react-router-ssr , but how to use it to response raw json? And make it not conflicting with existing client routing? 回答1: I found the answer. Meteor's default Webapp package will help (doc): WebApp.connectHandlers.use("/hello", function(req, res, next) { res.writeHead(200); res.end("Hello world from: " +

Send fully-formed HTML email

一曲冷凌霜 提交于 2019-12-23 01:28:18
问题 I'm trying to send a fully-formed and compliant HTML email via meteor, which should include the doctype and html tags: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> I've followed this solution: Using dynamic HTML templates in Meteor emails Which works for the most part, but Meteor cannot handle the doctype and html, throwing this error: While building the application: email

How to replace the Key for sort field in a meteor collection query?

随声附和 提交于 2019-12-23 01:20:08
问题 In the code below, I want to replace the name key with a value being passed in via a parameter this.params.sortby but I can't get it working. Looking for some help. So if: this.params.sortby=location I want this: Template.MyTemplate.helpers({ data: function () { return MyCollection.find({},{sort:{name: 1 }}); } }); To become this: Template.MyTemplate.helpers({ data: function () { return MyCollection.find({},{sort:{location: 1 }}); } }); 回答1: You can use an object with the bracket notation to

$where mongo operator work around in meteorjs

∥☆過路亽.° 提交于 2019-12-23 01:11:50
问题 I have a MongoDB query that works perfectly in MongoDB shell db.collection.find({ $where: function(){ var num = this.numbers; function isInList(numbers,matchArray) { var reducedNums = numbers.filter(function(num) { return matchArray.indexOf(num) !== -1 }); if (reducedNums.length == 7){ return true; } else { return false; } } return isInList(num, [ 28 ,5, 17, 47, 1, 24, 37, 19, 4, 3 ] ); } } ); How can I implement this in MeteorJS what is the work around? Explanations as per request: I need a

Why is ROOT_URL a required environment variable for bundle deployment?

两盒软妹~` 提交于 2019-12-23 00:42:58
问题 I have my Meteor app serving for a number of domains. The app's functionality is the same for all sites, but the host names dictate which templates I render. Everything works fine when I run my Meteor app in production with ROOT_URL pointing to only one of the domains. So I'm wondering, why is this a required environment variable other than for its use in Meteor.absoluteUrl() ? (which I personally don't use though I recognize it may be used elsewhere under the hood) 回答1: The use of this in

Meteor: one backend - multiple different front-ends 2x web and 1x mobile

别来无恙 提交于 2019-12-23 00:26:28
问题 I want one meteor server that can serve multiple different front-ends: Simple Web App Admin Web App Mobile App Each app has almost completely different HTML. Having all 3 packaged together isn't a blocker for the Admin and Mobile apps, but it is a blocker if the Simple Web app gets bloated with code from the other two. I don't understand enough about the Meteor build process to work out a solution. I could really use some help with best practices Some things I've tried: Separate apps ->