try the following in your router.js file Router.route('template1/template2',function() { this.render('template2'); }); ...
You need to subscribe it on client. This work for me: Boxes = new Meteor.Collection("boxes"); if (Meteor.isServer) { Meteor.startup(function () { Boxes.remove({}) //clearing the database Boxes.insert({ //adding one element to the database boxes: [1], currentId: 1 }); }); console.log("publish1") Meteor.publish("boxes", function() { console.log("publish2") //this does not run! ever! return Boxes.find();...
jQuery plugins need to be initalized when the corresponding HTML elements have been inserted in the DOM, which is usually the case in standard server side rendered webapps, but Meteor takes a different approach by using client side reactive templating, all the HTML generation is done in the browser. This...
It doesn't seem to be configurable at the moment based on this open issue. However, you could always fork the project and modify the start script to use your own custom docker image. If so, make sure you make it: FROM meteorhacks/meteord:base ...
javascript,meteor,package,translation
As far as I know, in terms of translations for account-related UI elements (buttons, links, placeholders and so on), meteor-accounts-t9n is set to work with the meteor-useraccounts packages. (core and framework-specific, such as bootstrap, foundation, ratchet...) With the meteor-useraccounts packages installed and in use (using {{> atForm}}), all you need...
I think this feature should be disabled for dev environments. It will probably be done so :] Not sure if this counts as an answer. I made a GH ticket to track the progress until its updated: https://github.com/Tarang/Meteor-Analytics/issues/28...
It looks like you are trying to specify fields in your find, which you can do like this: var options = { fields: { 'profile.name': 1, 'profile.description': 1, 'profile.picture': 1, 'profile.website': 1, 'profile.country': 1 } }; Meteor.users.find({_id: {$in: myArray}}, options); However, if this is being used in a publish function,...
javascript,json,mongodb,meteor
JS Template.test.helpers({ itemsArray: function(){ // This would normally be the result of your Mongo query var itemsArray = [ { "_id": "SXTJBs7QLXoyMFGpK", "Brand": "Nike", "Material": "Cooton", "Price": "67484", "ComboId": "y23", "Color": "White", "LaunchDate": "08/02/2015", "DiscountActiveDate": "08/03/2015", "DiscountInactiveDate": "08/04/2015", "Category": "Sport", "ProductSubCategory": "trackpant", "Status": "Pending", "TemplateID": "557fc7d06ecb48d38a67a380" }, { "_id": "IGJHihljiUYG6787y",...
Deploy the app using Meteor Up which have built in SSL support. Or use common web server like Nginx or Apache, setup SSL and reverse proxy back to meteor app. Example: Nginx configuration server { listen 80; server_name www.example.com; rewrite ^ https://$server_name$request_uri? permanent; } server { listen 443 ssl ;...
Yup! You can simple define arrays in SimpleSchema using this notation: ... 'problems': { type: String, autoform: { afFieldInput: { options: function () { return { one: 'one', two: 'two', three: 'three', four: 'four', five: 'five', six: 'six', } } } } } ... And in your template {{ >...
This is the equivalent. It's a bit prettier in javascript. Server side code: var result = HTTP.post("https://api.locu.com/v2/venue/search", { data: { "fields": ["name", "menu_items", "location", "categories", "description"], "menu_item_queries": [{ "price": { "$ge": 15 }, "name": "steak" }], "venue_queries": [{ "location": { "locality": "San Francisco" } }], "api_key": "YOUR_API_KEY" } }); console.log(result.data);...
Several issues: As pointed out by uZar accounts-base needs to be installed. Additionally, accounts needs to be configured on both the Client and server side. On the server: Meteor.startup(function(){ // setup to send email smtp = { username: 'xxxxx', // eg: [email protected] password: 'xxxxx', // eg: 3eeP1gtizk5eziohfervU server: 'xxxxx', //...
javascript,facebook,mongodb,meteor,collections
Since the user's collection is automatically defined you can't re-define it. You can though reference the existing collection: Instead of: Users = new Mongo.Collection("users"); Use Users = Meteor.users; ...
There isn't an obvious way to do this in the current version of meteor. One solution is for the child template to "inherit" the helpers from the parent. You can do this pretty easily using meteor-template-extension. Here's an example: html <body> {{> parent}} </body> <template name="parent"> <h1>parent</h1> {{> child}} </template>...
In keeping with your current schema (not recommended): First, save the entire document to the client: doc = { _id: 1, projectName: name, managers: [ { managerId: "manager1", status: false, startDate: "startDate", endDate: "endDate" }, { managerId: "manager2", status: false, startDate: "startDate",endDate: "endDate" }, { managerId: "manager3", status: true, startDate:...
The easiest way would be to do Template-level subscriptions. Template.myTemplate.onRendered(function() { var subscription = this.subscribe('publicationName', publicationArguments); } That is a very simplified way of doing it, but you should have no problems with your helper running first. Edit: The Discover Meteor blog has a great post about Template-level subscriptions. I...
It turns out the issue was within the click event. I had a nested span element within my share-course button: <small class="share-course" data-courseid="{{_id}}"> Share <span class="glyphicon glyphicon-share"></span> </small> This was messing up the way I was targeting my embedded courseID Instead of Blaze.getData(), I should have also been using Template.currentData()...
javascript,node.js,session,meteor
I don't really understand your need. Why do you want to share Session with Server ? Session is client-side only, but you can send value if your session with Meteor Methods, or in your subscription. In the second case, your sbscription can be reactive with the Session dependancy. Could you...
Make sure you also define this collection on the server side: Uploads =new FS.Collection('uploads',{ stores: [new FS.Store.FileSystem('uploads',{path:'~/projectUploads'})] }); The reason it can't find the method is the collection isn't defined on the server side (in the /server folder) or in a block of code that runs in if(Meteor.isServer) { instead...
It depends of you want to do it on client or server. First, the obvious solution: if you have no specific reason to store them with the first structure, store them directly using the second. Second, another easy solution is to make in client. Here is a non tested code...
mongodb,meteor,meteor-publications
It's relatively easy to keep fields private even if they are part of the database query. The last argument to self.added is the object being passed to the client, so you can strip/modify/delete fields you are sending to the client. Here's a modified version of your fiddle. This should do...
javascript,mongodb,meteor,publish-subscribe,meteor-blaze
Option 1: Keep track number of comment in the Posts collection itself. Each time new Comment inserted, update the counter: Posts.update( { _id: String }, { $inc: { commentsCount: 1 } } ) This way you doesn't need to subscribe Comments just to get the count, which will involve multiple...
meteor,jasmine,meteor-velocity
Yes, it is possible to test packages with sanjo:jasmine. It works in nearly the same way as with TinyTest. You can find all information to get started in the sanjo:jasmine README. There is also an example package. To run the tests, use the commands from the README. If you need...
As far as I see it, you have two options: Store user-ids there with type: String Denormalize it as you proposed Denormalize it as you proposed To denormalize it you can do something like this inside your schema: ... modifiedBy: { type: object } 'modifiedBy._id': { type: String, autoValue: function...
javascript,meteor,xmlhttprequest,cross-domain,cors
The answer is more than obvious after finding out. I just need to to set the options method in the restivus route to authRequired: false. You cannot send a complete header with credentials when doing a preflight. Now I am first doing the preflight and then sending the real post.
To add to what Matt K said (because comments suck and there's really bad code formatting in comments), a possible example of code that creates a named collection and maintains synchronization of its data between the connected clients and the server: /lib/collections.js - runs on both server and client Categories...
You need to make map a global variable: var map = null; Template.dynamicmap.rendered = function() { var southWest = L.latLng(35.02035919622158, -121.21049926757814); var northEast = L.latLng(42.4426214924114, -110.79740478515624); var mybounds = L.latLngBounds(southWest, northEast); map = L.map('map_container',{zoomControl: false, ... ... ...
You're welcome! I initially forgot to post it here too. We all need recognition when we can get it, thanks. I found this quote somewhere, sounds like a starting point to check...I n your EC2 control panel, look at your instance and note the Security Group that is assigned to...
javascript,json,meteor,data,startup
Ok, you'll want to check out Structuring your application. You'll have to make the file with the definition load earlier, or the one with the fixture later. Normally you have your collections inside lib/ and your fixtures inside server/fixtures.js. So if you put your insert code into server/fixtures.js it'll work....
To get barcode scanning capability, use BarcodeScanner cordova plugin: meteor add cordova:[email protected] Template <head> <title>Barcode Scanner</title> </head> <body {{> barcode_scanner}} </body> <template name="barcode_scanner"> <button>Scan</button> </template> JS if (Meteor.isCordova) { Template.barcode_scanner.events({ 'click button': function () { cordova.plugins.barcodeScanner.scan( function (result) { alert("We got a barcode\n" + "Result: " +...
Probably, the d index referenced in each autorun is the same one, therefore after the for loop, d ends up being equal to 7. It's apparently a common pitfall. An easy fix would be to call a self-invoking function within your for loop : ... for d in [0..6] do...
javascript,twitter-bootstrap,meteor
That's something you need to deal with using your publications/subscriptions. See here and here for learning ressources. Basically, what should happen is that when user A creates a form (or any object), you store it into a collection along with the user id (Meteor.userId()). You subscribe to a publication in...
You only need one new Mongo.Collection declaration per collection in meteor app.
javascript,ajax,http,meteor,facebook-javascript-sdk
Don't pass a callback to get the HTTP to return. You're also able to pass off URL parameters quite easily: var result = HTTP.call("GET", "https://graph.facebook.com/me", { params: { access_token : Meteor.user().services.facebook.accessToken, fields : "likes.limit(5){events{picture,cover,place,name,attending_count}}" } }); console.log(result); ...
Create a packages/ directory at the top level directory of your app (myapp/packages) and simply git clone the package you want to modify into it. Add the package via meteor add and you'll be able to edit the files of the package you just cloned. ...
facebook,facebook-graph-api,meteor
This would be correct: https://graph.facebook.com/me?fields=birthday&access_token=[your-user-token] You should start reading the Facebook docs about Access Tokens and API endpoints. You can test the API with the API Explorer....
The Meteor cursor is like a lazy version of the array of documents. It's designed to iterate through the results of a query while not actually loading each of the documents until they are actually requested or the cursor is at the position containing the document. Its better to think...
javascript,web-applications,meteor,filepath
You are here: projectRoot/.meteor/local/build/programs/server/shell-server.js So, to reference a script that lives in a sibling folder of your project, it'll look something like this: ../../../../../../scriptFolder/script.rb...
I didn't see anything in the docs how to do it better than your idea. There's another possible approach shown below which iterates over these subscription objects : https://github.com/meteor/meteor/blob/devel/packages/ddp-server/livedata_server.js#L241 You can try it by putting the below code in your Server meteor code. Meteor.setInterval(function(){ var output = {}; var connections...
angularjs,meteor,angular-meteor
Urigo:angular-meteor is the package that you can use for development in meteor + angular. check out this video by uri himself explaining thoroughly about the package and development using it also.
mongodb,meteor,collections,insert-update
Give something like this a try: // fetch the current list var list = Lists.findOne(_currentListId); // find the number of existing items and handle the case where there are none var numItems = (list.items || []).length; // the the next item key will be one more than the length var...
angularjs,meteor,angular-meteor
Issue is with file path of index.ng.html in index.html's ng-include It should be <div ng-include="'client/index.ng.html'"> </div> Path are always absolute , as mentioned in Angular Meteor tutorial It's very important to note - the paths are always absolute, not relative! so if 'index.ng.html' was inside a client folder, you would...
I've seen a similar issue, it makes me think that when you are "changing pages" you are not actually "destroying" the template temp, as the selectpicker() doesn't get called again when you "change back". You don't show enough information to answer this accurately, but you can try Destroying the selectpicker()...
A few suggestions: this.route('home', { path: '/:_id', data: function() { // assuming you have a collection called "Threads" return Threads.findOne(this.params._id); } }); You need a template called 'home'. It's data context will be the return of the data callback You do not need to place a ? in the path...
database,image,mongodb,meteor,collectionfs
Go to the Meteor Mongo console: meteor mongo See all the collections that are available: show collections Look for the one that has cfs.collection_name.files Choose the one that has your collection name. For example, I'm using collectionFS with gridFS for images. When I type show collections, I see cfs_gridfs.images.files so...
You want to check out Blaze.getData and Blaze.getView. With Blaze.getData you can simply do this: Blaze.getData(document.querySelector('.someelement')) This works pretty well, but you have to have an element inside the template-instance you can query for....
Try accessing the selections field of the document, that should give you the array directly, not the entire document: var selected = Charts.findOne({_id:this._id}, {selections:1, _id:0}); would give you { "selections": ["A","B"] } But var selected = Charts.findOne({_id:this._id}, {selections:1, _id:0}).selected; will give you the needed array ["A","B"] ...
angularjs,meteor,ionic-framework,meteor-blaze,meteoric
Try to set up a template around your html: <template name="myTemplate"> <div class="list"> <a id="myDiv" class="item item-icon-right nav-clear" href="#/app/list1"> <i class="icon ion-ios7-paper"></i> Item 1 </a> .... </div> </template> Then put this code into your js file: Template.myTemplate.events({ "click #myDiv": function( event) { // yourFunction }, }); ...
javascript,node.js,curl,meteor
You could just use node's fs and https APIs var fs = require('fs'); var https = require('https'); var rs = fs.createReadStream( 'Calvin Harris - Thinking About You (Tez Cadey Remix)_165299184_soundcloud.mp3' ); var req = http.request({ hostname: 'api.idolondemand.com', path: '/1/api/async/recognizespeech/v1', method: 'POST' }, function(res) { // do something when you get...
javascript,html,css,meteor,ckeditor
You use triple braces in spacebars for this. So your answer is {{{body}}} ...
I'm not completely sure why this is failing. It could be because you are storing user objects instead of ids, and their fields must be exactly equal in order for the update to work. I'd strongly recommend reworking your schema to use an array of ids instead of objects. It's...
Something like this should work: 'submit form' : function(event){ event.preventDefault(); var query=document.getElementsByClassName("twilioProcessorsms")[0].value; var valueToInsert = { sms: esms }; valueToInsert[query] = { accountSID: accsid, authToken: token, phoneNumber: phno} }; ChoiceList.insert(valueToInsert); ...
There's something abnormal about my app, because IR doesn't normally rerender the layout between routes: http://meteorpad.com/pad/qcu8QWASvPEjDEf5k/IR...
Your data object declaring syntax is wrong, it should be : this.render('PackageDetails', { data: { package: package, listItems: listItems } }); Then in your template, you can reference the data context using {{package.property}} and {{#each listItems}}....
angularjs,meteor,angular-meteor
Not sure about wrapbootstrap, but generally this error means you are using incompatible versions of angular and angular-cookies. The external angular modules you use (e.g. ngAnimate, ngCookies, ngResource, ngRoute etc), should always be the same version as angular.
Meteor's collection API is somewhat different from that of the mongo API. find takes up to two parameters: a selector object, and an options object. options allows you to specify such things as sort, skip, limit and fields, in addition to the meteor-specific reactive and transform.
Below you can find typical schema how to get data from database and display on client side. Please use it as inspiration. On the server side create publish function: Meteor.publish('article',function(articleId){ check(articleId, String); return Articles.find({_id:articleId}) }) routes.js Router.route(':categoryName/article/:_id',{ name:'full.article', template: 'fullArticle', waitOn: function () { return Meteor.subscribe( 'article', this.params._id ), },...
I think that you cannot chain two helpers with parameters on the second one like you did. Subsequent parameters will still be interpreted as parameters from the first helper. I see two ways for solving this problem: 1) you could get rid of the parameters and use the data context...
javascript,meteor,meteor-helper
First, just to be sure I understand your situation, let me rephrase it: You have a collection of documents that you want to sort using categories (which are stored for each document in a dedicated field). On one hand, you want to build a dropdown using all the possible categories...
meteor,fullcalendar,semantic-ui
After your template with class calendar has been added to the HTML you can use $('#myCalendar'). If the calendar is already rendered you can't use: $('#myCalendar').fullCalendar({gotoDate: moment(Session.get('date'))}); To go to a date you might want to call: $('#myCalendar').fullCalendar('gotoDate', moment(Session.get('date'))); ...
If you plan to use reactive data among several templates in the same page, I advise you to declare a reactive variable (ReactiveVar()) or a reactive dictionary At the beginning of your js file (if you have several, use the parent template file), outside any template.yourTemplate.rendered or template.yourTemplate.rendered, you declare...
meteor,meteor-autoform,meteoric
This is a issue with the new patch for autoform-ionic to the new versions of autoform. Apparently some labels are skipped, some not (see here). In order to fix that and avoid this error when your input type is not there (for example, type = number), all your schema fields...
You need to have a Session.set( "wordIds"... somewhere in that callback. If that doesn't change, your cursor in your helper won't change. Since your current cursor includes all the current docs, when you delete something it will react. PS, try doing away with the session var all together. Handle that...
This should work and result should populate with a result as you see in the stripe documentation: var result = stripeChargesCreateSync({ source: stripeToken, amount: (info.timeRequired/15)*500, // this is equivalent to $50 currency: 'gbp' }); This is where the error is, use this: var stripeChargesCreateSync = Meteor.wrapAsync(Stripe.charges.create, Stripe.charges); instead of var...
Generally I prefer to run migration scripts from the mongo shell since it's easier to execute (compared to deploying the code that runs the migration) and it gives you access to the full mongo api. You can run load(path/to/script) in the mongo console if you want to pre define your...
From what I understand the environment variable is only for the deployment mode (running a bundle). In development, i.e., when running meteor, you need to use the --settings command line parameter to specify a file containing the settings....
Your call to the Router.map function is unnecessary. It doesn't do much, as you can see here. Also you can omit the onBeforeAction hook if you're just calling this.next(). But I too, don't see anything wrong with your code. Here are some things you could try tho: Check if your...
Router.route("/:name", { name: "home", template: "home", data: function(){ // this will create a new key myName on the route object for this route // and set the value to the name that the user entered in the path this.route.options.myName = this.params.name; return { label: this.params.name }; } }); // All...
Finally found the source of my problem maybe my answer would help other Meteor developers. I used to do this : var providersSub = Meteor.subscribe('providers'); Tracker.autorun(function () { if(!providersSub.ready()) return; var providerIds = _.pluck(Provider.all().fetch(), '_id')); ... this.stop(); }); Instead of : var providersSub = Meteor.subscribe('providers'); Tracker.autorun(function (computation) { if(!providersSub.ready()) return;...
Here you go: https://github.com/fourseven/meteor-scss Very popular and actively-managed package for SCSS users....
You cannot attach helpers to body. Helpers have to be attached to a template. What you should do is this: in the HTML: <body> {{> membersList}} </body> <template name="membersList"> <ul> {{#each members}} <li>{{name}}</li> {{/each}} </ul> </template> In the JS: Template.membersList.helpers({ members: function() { return Members.find(); } }); ...
Try insertIntoCollection(Services, serviceItems); .... With your previous code of "Services" being a string, you were essentially calling this in the function: "Services".insert(arrayOfObjects[index]); Which is obviously not the end result you want... On the side note, it's discouraged to use a key in object loop on arrays... Try looping through it...
I think the developer created the method wrapMethod on his PB obejct. As you can see here there is nothing called wrapMethod in Meteor. I guess they wrote something like this: PB.wrapMethod = function wrapMethod (meteorMethod) { return function wrappedMeteorMethod (/*arugments*/) { Meteor.apply(meteorMethod, arguments) } } I think it's kinda...
In your jasmine test you can mock a call to Meteor.user() like so: spyOn(Meteor, "user").and.callFake(function() { return 1234; // User id }); ...
Turns out that for routes with "/" you need to use ".". So in this case I used: only: ["challenge.:_id"] Problem solved!...
You need to enforce the filters one after the other. Try like that: var filterAndLimitResults = function (cursor) { if (!cursor) { return []; } var raw = cursor.fetch(); var currentChosenCategory = chosenCategory.get(); var currentChosenCity = chosenCity.get(); var currentJtype = chosenJtype.get(); console.log(currentChosenCategory); console.log(currentChosenCity); // filter category var filtered = [];...
The pathFor helper takes the params for the URL from the context it is called from. So in your case it will search for username inside the userProfile-template instance. So there are two ways of going about this. You could add username to the data context Use a spacebars with-block...
You cannot call helpers with arguments in an #if. I assume that the template instance's data context is a Unit document because of your use of this._id. If so, can just do; {{#if profile}} {{profile}} {{/if}} The #if checks whether its argument is truthy....
meteor,mongodb-query,roles,groups
This code has about a 5% chance of working out of the box because I have no collection to test this on, I have no way of running this code, I don't have the roles package, I don't have your users database, and I've never done .map on a cursor...
onRendered only fires when an instance of the template is added to the DOM, it will thereby not fire again on data changes. If you want to execute code once the data is ready you should use the template.autorun function like so: Template.profielBewerken.onRendered(function () { this.autorun(function (comp) { if (Meteor.user())...
Read about it here Router.route( '/admin/users/details/:userID', { name: 'admin.details', ... } ); Template.AdminUsersDetailsDetailsForm.events({ "click #form-back-button": function(e, t) { e.preventDefault(); Router.go('admin.details', {userId:'USER_ID'}); } You can generate url using: Router.path('admin.details', {userId:'USER_ID'}); ...
Plugins should be initialized in your template's onRendered callback. For example: Template.myTemplate.onRendered(function() { $(".typedelement").typed({ strings: ["You don't have any projects yet", "Start by adding a project."], typeSpeed: 0 }); }); ...
With respect to this issue, the load order rules work as follows: Paths containing lib gain priority. Paths gain priority based on their depth. Combining the two shows us that /server/lib/x.js will be loaded before /lib/x.js. With methods this shouldn't be an issue unless the method is invoked as soon...
Say that the user is on a route /something You have some data that changes and you create a session variable: Session.set("someDataThatChanges", myChangedData) Your publish function takes some sort of input, which it uses to return different data from the collection: Meteor.publish("myCollection", function(input){ return myCollection.find( // do something here based...
Use fields (?): return MyCollection.find({},{fields:{"MWLink.LinkID": 1}}).fetch(); If you feel you need a bit more power on what comes up you can use map (?) or a transform (?): var transform = function(doc) { return { MWLink : { LinkID: doc.MWLink.LinkID } } } //A transform returns a cursor return MyCollection.find({},...
this.data is immutable. To replace the data context either wrap your mine template and pass the correct data. E.g.; <template name="mineWrap"> {{> mine mydata}} </template> Or, store your data directly on the template instance. E.g.; Template.mine.onCreated(function () { this._myData = 'data'; }); Template.mine.helpers({ myData: function () { return Template.instance()._myData; }...
You have a couple of options, but the easiest is just to mark the questions as inactive as soon as their author becomes inactive. Here's an example deleteUser method: Meteor.methods({ deleteUser: function() { // mark the user as inactive Meteor.users.update(this.userId, {$set: {isInactive: true}}); // mark the user's questions as inactive...
meteor,meteor-helper,meteor-collections
You might be better off using Contracts._id to refer to a contract from the Reminders collection that way if the contract name and description change at some point you won't need to update all the related reminders. Contract: { "_id": "tPN5jopkzLDbGypBu", "contract": "C-42432432", "description": "Description of contract", "counterpart": "Company name",...
Just restructure your method where you also name the function of the method, then you have two entry points into whatever code it is you'd like to execute: addUser = function() { ... }; Meteor.methods({'addUser': addUser}); Router.route('/sms/inbound', function () { if (something) { addUser({ name: "hello", age: 20 }); }...
meteor --test is a Velocity command that is built-in to Meteor. You may want to use meteor --once so that Meteor does not restart