meteor

Why my collection.find() does not work in meteor but work in robomongo?

泪湿孤枕 提交于 2020-01-11 12:36:13
问题 I have a publication that should return me all users matching an _id array. here it the query: Meteor.users.find({ '_id': { $in: myArray}},{ 'profile.name':1, 'profile.description':1, 'profile.picture':1, 'profile.website':1, 'profile.country':1} ); When I run it in Robomongo (the mongo browser), it works. But my publication only returns undefined . when I console.log(myArray); in the publication, I get something like this ['FZ78Pr82JPz66Gc3p'] . This is what I paste in my working Robomongo

MeteorJS: Users collection how to expose new field

落花浮王杯 提交于 2020-01-11 10:57:11
问题 I have added new field in user collection but when I access it in the client side Meteor.user().cart ( cart is my new field). Its undefined. How can expose new field (cart) so that it can be access in the client? 回答1: The easiest way is to add a null publisher which will automatically send the data without the need for a subscription. Be sure to limit the fields to only the ones you need. Meteor.publish(null, function() { return Meteor.users.find(this.userId, {fields: {cart: 1}}); }); 来源:

Long computations on Meteor

a 夏天 提交于 2020-01-11 10:35:12
问题 I learned that in Node.js you yield in between long computations to prevent the server from blocking. How do you achieve this on Meteor? Are there techniques for also doing this on the client? I am new to web development, simple examples would be appreciated. 回答1: Meteor uses Fibers which behave a little different than usual Node.js code. I believe there's no need to yield manually. Instead, you may want to use this.ublock() method on the server side – see this awesome article that explains

How to pass a template variable to a template helper function to preserve context?

∥☆過路亽.° 提交于 2020-01-11 10:23:30
问题 I may be using the wrong words to describe my issue so here is the (simplified) code I'm working with. I'm happy to learn a better way to do this but what I'm currently trying to do is pass {{assigneeId}} to the template helper function called agentIs . The problem is that I can't find the correct way to pass the value. <template name="ticket_list"> {{#each tickets}} {{> ticket}} {{/each}} </template> <template name="ticket"> <h3>{{title}}</h3> <p>{{assigneeId}}</p> {{> ticket_footer}} <

“415 Error” when querying Spotify for tokens

安稳与你 提交于 2020-01-11 08:21:25
问题 I've been trying to recreate the spotify oauth connection in MeteorJS. I've gotten as far as requesting the access and refresh tokens, but I keep getting a 415 error now. Here is the relevant code: var results = HTTP.post( 'https://accounts.spotify.com/api/token', { data: { code: code, redirect_uri: redirectURI, grant_type: 'authorization_code', client_id: clientID, client_secret: clientSecret }, headers: { 'Content-Type':'application/json' } } ); I can't seem to find any other good

“415 Error” when querying Spotify for tokens

可紊 提交于 2020-01-11 08:21:08
问题 I've been trying to recreate the spotify oauth connection in MeteorJS. I've gotten as far as requesting the access and refresh tokens, but I keep getting a 415 error now. Here is the relevant code: var results = HTTP.post( 'https://accounts.spotify.com/api/token', { data: { code: code, redirect_uri: redirectURI, grant_type: 'authorization_code', client_id: clientID, client_secret: clientSecret }, headers: { 'Content-Type':'application/json' } } ); I can't seem to find any other good

Can we use Meteor framework with mysql database

做~自己de王妃 提交于 2020-01-11 06:01:23
问题 I found many refer url for Meteor framework where i found mongodb as database, since i don't have much knowledge in mongodb. So is there any way to implement mysql instead of mongodb 回答1: There is a way, but at the stage the framework is right now it's an unpaved road. Basically, you'd need to write a wrapper that would translate from SQL to Meteor's Minimongo and back. It's not a feasible task if you're not a Meteor and Mongo master already. There were attempts to write such adapter. The

Inserting a momentjs object in Meteor Collection

心已入冬 提交于 2020-01-11 04:38:26
问题 I have a simple Meteor collection and I am trying to insert a document that has a momentjs property into it. So I do: docId = Col.insert({m: moment()}); However, when I try to get this document back with doc = Col.findOne({_id: docId}) I get "Invalid date" for doc.m like so: Object {_id: "wnHzTpHHxMSyMxmu3", m: "Invalid date"} Anyone?! 回答1: I strongly recommend storing dates as Date objects and using moment to format them after they are fetched. For example: Posts.insert({message: 'hello',

Meteor js templates rendered vs onRendered

你离开我真会死。 提交于 2020-01-10 03:44:09
问题 After working fine with Template.name.rendered = function () { ..... } I changed this to: Template.name.onRendered(function(){ ..... }) but I don't have the same results and I don't find too much documentation about the differences, some one would help me please? or someone knows where I can see the differences? 回答1: In Meteor 1.0.4 rendered got deprecated and replaced by onRendered : Add onRendered, onCreated, and onDestroyed methods to Template. Assignments to Template.foo.rendered and so

how do I install a previous version of meteor JS?

假如想象 提交于 2020-01-09 13:10:23
问题 I'm trying to host a meteor app that uses an old version of meteor. Every time i try to start the app it will get somewhat through the process of installing the tool, and then i see a message such as: Killednloading meteor-tool@1.1.3... - (note how killed somehow overwrites the downloading part of the command line) Is there a reliable way to install the meteor tool at a specific version? 回答1: EDIT: The Meteor team added a release parameter to their download endpoint. Now you can simply