meteor

How do you ensure an update has finished in meteor before running a find?

…衆ロ難τιáo~ 提交于 2019-12-25 06:59:09
问题 I have a fairly typical need, to ensure an insert / update has finished before I run a find. The code goes something like this: //Update my collections Messages.insert({author:_id,text:text}); Authors.update({_id:_id},{$inc:{messages:1}}); //Wait until the update / insert has finished //Perform some actions on the collections just updated var author = Authors.findOne({task:taskId},{sort:{'messages':1}}); //Do some more complex stuff... While in most cases this would be fine as asynchronous

Select category not updating sub category

送分小仙女□ 提交于 2019-12-25 06:44:42
问题 This is suppose to look at the users category selection and then update the subcategory. The solution was recommended by someone else but I can't seem to get it to work. When I select the category, subcategory doesn't update. Can someone let me know what I'm missing. Path: category.js <template name="category"> {{#autoForm collection="Meteor.users" id="categoryForm" doc=currentUser type="update"}} {{> afQuickField name='profile.categories'}} {{/autoForm}} </template> Path: Schema.js var

Simple search function in meteor using EasySearch package

只谈情不闲聊 提交于 2019-12-25 06:41:07
问题 Good Day, I'm trying to create a simple search function using the easy search package. In a nutshell I have done the following- Defined a schema and index on the client as such: const Patients = new Mongo.Collection('patients'); const PatientsIndex = new EasySearch.Index({ collection: Patients, fields: ['name'], engine: new EasySearch.MongoDB() }); I've entered the following values into the database: meteor:PRIMARY> db.patients.find() { "_id" : ObjectId("57d6a9f71bad26ba07748f9d"), "name" :

Error when updating an object in auto-form with meteor

社会主义新天地 提交于 2019-12-25 06:36:29
问题 I have checked the docs but I cannot get my head around this. I have an object that I want to update using Auto-Form and Collections2 with meteor. //Schema Records = new Mongo.Collection('records'); var Schemas = {}; Schemas.Record = new SimpleSchema({ title: { type: String, label: "Title", max: 200 }, caption: { type: String, label: "Caption", max: 200 }, text: { type: String, label: "Detailed text", optional: true, max: 1000 }, loc: { type: Object, optional: true, blackbox: true },

Error when updating an object in auto-form with meteor

血红的双手。 提交于 2019-12-25 06:35:09
问题 I have checked the docs but I cannot get my head around this. I have an object that I want to update using Auto-Form and Collections2 with meteor. //Schema Records = new Mongo.Collection('records'); var Schemas = {}; Schemas.Record = new SimpleSchema({ title: { type: String, label: "Title", max: 200 }, caption: { type: String, label: "Caption", max: 200 }, text: { type: String, label: "Detailed text", optional: true, max: 1000 }, loc: { type: Object, optional: true, blackbox: true },

How do I insert a meteor template that contains double quotes in a place where those double quotes are needed?

隐身守侯 提交于 2019-12-25 06:26:28
问题 In my meteor web app I am trying to change the background of a certain element conditionally with this code: .popular-games{ background-image: url({{background}}); } {{background}} being the path it should follow to find the image. This will not work though because the url path needs quotes, and when I put in quotes in negates {{background}}. I've tried putting the quotes into the source where {{background}} is coming from with this code: background: "\"images/gameArt/fallout4.jpg\"" trying

ReferenceError: Template is not defined in Meteor

爷,独闯天下 提交于 2019-12-25 06:07:08
问题 As far as I can see all the javascript files and html are correct. W20151006-00:40:17.144(0)? (STDERR) W20151006-00:40:17.145(0)? (STDERR) /home/nitrous/.meteor/packages/meteor-tool/.1.1.9.b2s4xu++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib /node_modules/fibers/future.js:245 W20151006-00:40:17.147(0)? (STDERR) throw(ex); W20151006-00:40:17.149(0)? (STDERR) ^ W20151006-00:40:17.158(0)? (STDERR) ReferenceError: Template is not defined W20151006-00:40:17.158

Join in Meteor with publishComposite

安稳与你 提交于 2019-12-25 06:07:01
问题 I have removed autopublish from my Meteor app. Now I'm publishing my collections manually. I have some related collections. I want to increase performance as much as possible. If I'm, for instance, looking at a post and want to see all the comments related to this post, I have to query the database with both post: Posts.findOne(postId) AND comments: Comments.find({postId: postId}) . I am querying the two collections in the data field with iron-router so they are present in my template but I'm

Meteor: resetPassword email link behavior

谁说我不能喝 提交于 2019-12-25 05:43:16
问题 I'm trying to implement the "reset password" functionality in my Meteor app. I have a very simple implementation of it based on this tutorial: Julien's tutorial on gentlenode There are several examples floating around that use this same basic approach. I did mine almost exactly like Julien's but I used only one template; I use an {{#if}} in my template that displays the 'reset password' form, if my session variable sResetPassword is not falsey. (I don't know how the correct template is

Meteor template helpers fire multiple times

泄露秘密 提交于 2019-12-25 05:28:05
问题 Template.templateName.helpers({ // SOME CODE HERE LIKE myLove: function() { console.log("Fired"); return "meteor.js"; } }); What works like a charm... but with one huge problem... when i want to use variable "myLove" in template like 5times (in different places) when i check console it fires multiple times so when i have there database query it runs multipletimes what is definely not good... how to fix it? BTW: i use handlebars for template. 回答1: If you use this template in multiple places,