First, I'm sorry I don't have more to describe this, but its some sort of obscure Meteor 1.2 bug. At least for me, since I am new.
Basically I am creating a one page intranet app that polls paysimple.com
API, stores the results in MongoDB and lets Meteor use its reactive magic to push the new results to the page.
At first I thought this was related to this question: Meteor, '/users/insert' is already defined
Because I was using the word "Transactions" and thought I hit a keyword, but I rewrote the code to use the word "Payments".
Here is the error
W20150928-18:57:59.477(-7)? (STDERR)
W20150928-18:57:59.478(-7)? (STDERR) /Users/robert/.meteor/packages/meteor-tool/.1.1.8.1ywvo10++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150928-18:57:59.478(-7)? (STDERR) throw(ex);
W20150928-18:57:59.478(-7)? (STDERR) ^
W20150928-18:57:59.548(-7)? (STDERR) Error: A method named '/payments/insert' is already defined
W20150928-18:57:59.548(-7)? (STDERR) at livedata_server.js:1536:15
W20150928-18:57:59.548(-7)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
W20150928-18:57:59.548(-7)? (STDERR) at [object Object]._.extend.methods (livedata_server.js:1532:7)
W20150928-18:57:59.548(-7)? (STDERR) at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:923:1)
W20150928-18:57:59.549(-7)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:214:1)
W20150928-18:57:59.549(-7)? (STDERR) at components/App.jsx:3:17
W20150928-18:57:59.549(-7)? (STDERR) at /Users/robert/dev/paysimple-meteor/.meteor/local/build/programs/server/app/components/App.jsx:66:4
W20150928-18:57:59.549(-7)? (STDERR) at /Users/robert/dev/paysimple-meteor/.meteor/local/build/programs/server/boot.js:242:10
W20150928-18:57:59.549(-7)? (STDERR) at Array.forEach (native)
W20150928-18:57:59.549(-7)? (STDERR) at Function._.each._.forEach (/Users/robert/.meteor/packages/meteor-tool/.1.1.8.1ywvo10++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
The project is here on github: https://github.com/rbaindourov/paysimple-meteor
The bug did go away by itself! Sort of.
Crenshinibon, you are right that I did have multiple declarations of the collection, once in server/init.js
and once in components/App.jsx
at one point.
But when I refactored the code to have a /lib/collections.js
the error still persisted. This was the main problem that all my hunches kept getting invalided by meteor caching.
It wasn't until I renamed Task.jsx
to LineItem.jsx
and reflected that change throughout the application that the error just went away.
Which confirmed that there is a caching mechanism of some sorts that kept my bug hanging around, which was solved by some previous refactoring.
Therefore, I don't know exactly what change cleared the error, changing the collection name, or moving its declaration to one global lib file.
I've informed the meteor team here: https://forums.meteor.com/t/meteor-clear-cache/10507
They seem to agree that it's an issue.
Thanks again everyone, and I apologize for not committing the error before I fixed it. I was frantically writing code, and it just disappeared.