Thursday, May 19, 2016

Meteor TypeError: undefined is not a function

In Meteor, I was adding a new mongo collection using the following code:

 export const Areas = new Mongo.collection('areas');  

The app restarted and I got the following error:

 TypeError: undefined is not a function  
   at meteorInstall.imports.api.documents.js (imports/api/documents.js:8:22)  
   at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)  
   at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:75:1)  
   at meteorInstall.server.main.js (server/main.js:2:1)  
   at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)  
   at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:75:1)  
   at C:\Users\Philip\doc-revision\.meteor\local\build\programs\server\app\app.js:240:1  
   at C:\Users\Philip\doc-revision\.meteor\local\build\programs\server\boot.js:283:10  
   at Array.forEach (native)  
   at Function._.each._.forEach (C:\Users\Philip\AppData\Local\.meteor\packages\meteor-tool\1.3.2_4\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)  

It turns out that the word 'collection' should have been 'Collection'. This one was difficult to spot, but I eventual found it. The following code fixes the error


 export const Areas = new Mongo.Collection('areas');  

Wednesday, May 18, 2016

Grails 2.x + Webflow + Services defined in domain classes = Fail

Environment:

  • Grails 2.5.4
  • Webflow plugin 2.1.0

I know it's been documented that you can define services inside domain classes for a Grails project. And for the most part this works, until you want to use them in a webflow.

We started noticing some very strange behaviour where the domain classes stored in flow scope started missing property values. For some apparent reason, as the user progresses through the webflow, the properties of these domain classes would reset to null!!

The fix was to remove any service class definitions inside domain classes.


Tuesday, May 3, 2016

Meteor datepicker formatting

Meteor version: 1.3.2.4
Package: rajit:boostrap3-datepicker (https://atmospherejs.com/rajit/bootstrap3-datepicker)




 Template.body.rendered=function() {  
   $('.datepicker').datepicker({  
     format: "dd/mm/yyyy"  
   });  
 }