Meteor error: method named insert is already defined

I created a mongo collection called votes , which worked fine even after updating the packages to the latest meteor version. I don’t remember to change any part of the working code, but I get these errors. I updated the project using the meteor update command and tested it right after the update. It worked successfully at the time, but I don’t know why I get this error. And, I'm not sure which source file should be added to get help ...

Can anyone shed some light?

 W20141025-21:29:08.640(6)? (STDERR) W20141025-21:29:08.641(6)? (STDERR) /home/wasi/.meteor/packages/meteor-tool/.1.0.34.k7p01x++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:173 W20141025-21:29:08.641(6)? (STDERR) throw(ex); W20141025-21:29:08.642(6)? (STDERR) ^ W20141025-21:29:08.693(6)? (STDERR) Error: A method named '/votes/insert' is already defined W20141025-21:29:08.695(6)? (STDERR) at packages/ddp/livedata_server.js:1439 W20141025-21:29:08.696(6)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:113) W20141025-21:29:08.697(6)? (STDERR) at _.extend.methods (packages/ddp/livedata_server.js:1437) W20141025-21:29:08.697(6)? (STDERR) at Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:884) W20141025-21:29:08.698(6)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:208) W20141025-21:29:08.699(6)? (STDERR) at app/collections/collection.js:1:43 W20141025-21:29:08.700(6)? (STDERR) at app/collections/collection.js:58:3 W20141025-21:29:08.701(6)? (STDERR) at /home/wasi/AI/OVS/.meteor/local/build/programs/server/boot.js:168:10 W20141025-21:29:08.702(6)? (STDERR) at Array.forEach (native) W20141025-21:29:08.702(6)? (STDERR) at Function._.each._.forEach (/home/wasi/.meteor/packages/meteor-tool/.1.0.34.k7p01x++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/underscore/underscore.js:79:11) => Exited with code: 8 => Your application is crashing. Waiting for file change. [=================== ] 94% 4.8s 
+5
source share
5 answers

Note: If you use the Angular-Meteor tutorial to create a Socially application and you use an integrated development environment (IDE) like WebStorm , which can automatically compile TypeScript into JavaScript, my answer will probably help you solve this problem.


I got this error without overriding the collection. Later I found out that my IDE (WebStorm 2016.1) caused duplicates because it automatically compiled TypeScript into JavaScript, although Meteor handles this work for us. Fortunately, I got rid of this error by simply disabling the TypeScript compiler in WebStorm and deleting the compiler output files.

So, if WebStorm asks you if you want to compile TypeScript into JavaScript, say No !

WebStorm - Compile TypeScript into JavaScript

If you have already mixed up your settings, go to WebStormSettingsLanguages ​​and FramesTypeScript and uncheck the box “Enable TypeScript Compiler :

TypeScript Compiler in WebStorm Settings

After that, delete the output files of the TypeScript compiler:

WebStorm TypeScript Compiler Output

Your application should now work again. Happy coding!

+6
source

your xyz.js file code

  console.log("This is test panel ...."); new Mongo.Collection('players'); <<-------remove This line PlayersList = new Mongo.Collection('players'); 

remove

 new Mongo.Collection('players'); 
+5
source

I had this error because I had a new collection of the same mongo in two different variables.

eg.

 CrowdEstimates = new Mongo.Collection('crowdEstimates'); CrowdEstimateAggregations = new Mongo.Collection('crowdEstimates'); 

Cut and paste and distract.

+3
source

I think you have the same names for your methods in app/collections/collection.js

+2
source

I came across the same error message, this happened after I reorganized the folder structure of my application. I had a Javascript collection named drivers.js in a folder named both , and I had another Javascript file with the same name (and code) in both\collections\drivers.js .

Thus, the error message is more or less correct. Just weird looking, at least in my system.

0
source

Source: https://habr.com/ru/post/1205512/


All Articles