Error: collection declared twice

Hi,

I have an error message saying

Uncaught Error: There is already a collection named ‘trackings’

But it is declared just once in my JS files (in shared code):

trackings = new Mongo.Collection(“trackings”);

any clue why?

Thnx

Michael

The norm is to write, Trackings = new Mongo.Collection(“trackings”);
which in effect gives you two different labels.

I have tried with Trackings = new Mongo.Collection(“trackings”);

but I get the same error.

It’s weird because I have:

trackings = new Mongo.Collection(“trackings”);
stats = new Mongo.Collection(“stats”);

but stats does not create any error.

Search your code for another collection with the name "trackings" - maybe it’s in some package you are depending on? Is it possible that this code is being run twice?

1 Like

No, nowhere else.

I tried to rename trackings in trackings2 everywhere but it doesn’t help.

Can you put a console.log next to where the collection is defined, and see how many times it prints?

yep, here is the console:

=> App running at: http://localhost:3000/
I20160328-19:36:35.383(2)? print

does the (2) mean that it is printed twice?

No, that’s your time zone. You can check by printing the same message twice in a row.

I dunno, it’s very hard to help at this point without seeing your app code. There must be something missing from your description of the issue.

From the Remote debugger I get this. perhaps it is linked?

It looks like a hot code issue no?

[Log] METEOR CORDOVA DEBUG (meteor_cordova_loader.js) Error reading version file Error: Failed to resolve entry: file:///var/mobile/Containers/Data/Application/F973B54A-277A-4D19-8946-6011A1C8863B/Library/NoCloud/meteor/version (meteor_cordova_loader.js, line 12)

[Log] METEOR CORDOVA DEBUG (meteor_cordova_loader.js) Couldn’t load from the manifest, falling back to the bundled assets. (meteor_cordova_loader.js, line 12)

[Log] METEOR CORDOVA DEBUG (meteor_cordova_loader.js) Loading from url: http://meteor.local (meteor_cordova_loader.js, line 12)

Looks like you’re using Meteor < version 1.3 (since your log is showing the meteor.local URL). You might want to consider upgrading to Meteor 1.3 to see if that fixes your issue, since mobile support/functionality has been massively overhauled.

When I do meteor update:

This project is already at Meteor 1.2.1, the latest release.

Ok I see it is in Beta, so how to update?

Actually, it’s not beta anymore - it was officially (and so far quietly) launched about 17 hours ago. I bet there will be an official launch blog post soon.

In the meantime, run:

meteor update --release 1.3

1 Like

great thanks. trying…

Yep there’s a step between actually publishing the release, and triggering the Meteor tool to believe that it is the latest version. In between we do some final sanity checks and preparation.

I have updated to 1.3

Now the app works with meteor run.

But when trying meteor run ios, here is the log:

Is it a known error?

=> Started proxy.
=> Started MongoDB.
WARNING: iphone: unknown key in App.icons configuration. The key may be
deprecated.
WARNING: android_ldpi: unknown key in App.icons configuration. The key may be
deprecated.
WARNING: iphone: unknown key in App.launchScreens configuration. The key may be
deprecated.
WARNING: android_ldpi_portrait: unknown key in App.launchScreens configuration.
The key may be deprecated.
WARNING: android_ldpi_landscape: unknown key in App.launchScreens
configuration. The key may be deprecated.
=> Errors executing Cordova commands:

While removing plugins
cordova-plugin-meteor-webapp,cordova-plugin-wkwebview-engine from Cordova
project:
Cordova error: Cannot find plugin.xml for plugin ‘cordova-plugin-dialogs’.
Please try adding it again.
(If the error message contains suggestions for a fix, note that this may not
apply to the Meteor integration. You can try running again with the
–verbose option to help diagnose the issue.)

/Users/Michael/.meteor/packages/meteor-tool/.1.3.0_3.qqk2xp++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/isopackets/cordova-support/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:116
throw error;
^
ExitWithCode:1

after a Meteor reset:

iMac-de-Michael:jariv Michael$ meteor run ios
WARNING: iphone: unknown key in App.icons configuration. The key may be
         deprecated.
WARNING: android_ldpi: unknown key in App.icons configuration. The key may be
         deprecated.
WARNING: iphone: unknown key in App.launchScreens configuration. The key may be
         deprecated.
WARNING: android_ldpi_portrait: unknown key in App.launchScreens configuration.
         The key may be deprecated.
WARNING: android_ldpi_landscape: unknown key in App.launchScreens
         configuration. The key may be deprecated.
[[[[[ ~/Desktop/Jariv ]]]]]                   

=> Started proxy.                             
=> Started MongoDB.                           
WARNING: iphone: unknown key in App.icons configuration. The key may be
         deprecated.
WARNING: android_ldpi: unknown key in App.icons configuration. The key may be
         deprecated.
WARNING: iphone: unknown key in App.launchScreens configuration. The key may be
         deprecated.
WARNING: android_ldpi_portrait: unknown key in App.launchScreens configuration.
         The key may be deprecated.
WARNING: android_ldpi_landscape: unknown key in App.launchScreens
         configuration. The key may be deprecated.
% Notice: org.apache.cordova.geolocation has been automatically converted to cordova-plugin-geolocation and fetched from npm. This is due to our old plugins registry shutting down.
% Notice: org.apache.cordova.dialogs has been automatically converted to cordova-plugin-dialogs and fetched from npm. This is due to our old plugins registry shutting down.
% Notice: org.apache.cordova.geolocation has been automatically converted to cordova-plugin-geolocation and fetched from npm. This is due to our old plugins registry shutting down.
% Notice: org.apache.cordova.dialogs has been automatically converted to cordova-plugin-dialogs and fetched from npm. This is due to our old plugins registry shutting down.
% The module "ConfigParser" has been factored into "cordova-common". Consider update your plugin hooks.
Looks like we're in Cordova 5.0 and above... [=====                  ] 22% 15.7s
Creating new Bridging-Header.h at path:  /Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/Jariv/Plugins/Bridging-Header.h
Importing Loc-Bridging-Header.h into main bridging-header at: /Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/Jariv/Plugins/Bridging-Header.h
IOS project now has deployment target set as:[7.0] ...
IOS project option EMBEDDED_CONTENT_CONTAINS_SWIFT set as:[YES] ...
IOS project swift_objc Bridging-Header set to:[/Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/Jariv/Plugins/Bridging-Header.h] ...
IOS project Runpath Search Paths set to: @executable_path/Frameworks ...
IOS project Adding libsqlite3...
I20160328-22:06:40.391(2)? print                                                
=> Started your app.                          
                                              
=> App running at: http://localhost:3000/     
=> Errors executing Cordova commands:         
                                              
   While running Cordova app for platform iOS with options --emulator:
   Error: Command failed:                     
   /Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/cordova/run
   --emulator
   ** BUILD FAILED **
   
   
   The following build commands failed:
   CompileSwift normal i386
   /Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/Jariv/Plugins/org.flybuy.cordova.background-location-services/CDVBackgroundLocationServices.swift
   CompileSwiftSources normal i386 com.apple.xcode.tools.swift.compiler
   (2 failures)
   Error code 65 for command: xcodebuild with args:
   -xcconfig,/Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/cordova/build-debug.xcconfig,-project,Jariv.xcodeproj,ARCHS=i386,-target,Jariv,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/Michael/Desktop/Jariv/.meteor/local/cordova-build/platforms/ios/build/sharedpch
   at ChildProcess.exitCallback (/tools/utils/processes.js:151:23)
   at ChildProcess.emit (events.js:98:17)
   at Process.ChildProcess._handle.onexit (child_process.js:820:12)
                                              
/Users/Michael/.meteor/packages/templating/.1.1.7.17gm79l++os+web.browser+web.cordova/plugin.compileTemplatesBatch.os/npm/node_modules/meteor/promise/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:116
      throw error;
            ^
ExitWithCode:1