Stuck with mongo index


#1

Hi guys,

I cannot seem to find a solution to this error:

MongoError: Index with name: _id_ already exists with different options
    at Object.Future.wait (/Users/roelvaneyghen/.meteor/packages/meteor-tool/.1.1.3.1xpf2ta++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15)
    at [object Object].MongoConnection._ensureIndex (packages/mongo/mongo_driver.js:733:1)
    at packages/aldeed:collection2/collection2.js:61:1
    at /Users/roelvaneyghen/Data/Git Repos/dsmtw/.meteor/local/build/programs/server/boot.js:229:5
    - - - - -
    at Object.toError (/Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/utils.js:114:11)
    at /Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/db.js:1352:26
    at Server.Base._callHandler (/Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/base.js:453:41)
    at /Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:487:18
    at [object Object].MongoReply.parseBody (/Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
    at [object Object].<anonymous> (/Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:445:20)
    at [object Object].emit (events.js:95:17)
    at [object Object].<anonymous> (/Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13)
    at [object Object].emit (events.js:98:17)
    at Socket.<anonymous> (/Users/roelvaneyghen/.meteor/packages/mongo/.1.1.0.gtodrv++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection.js:440:22)
Exited with code: 8
Your application is crashing. Waiting for file change.

I tried to reIndex() my mongo collection, but without success.

These are the packages I’m using:

accounts-password        1.1.1  Password support for accounts
aldeed:autoform          4.2.2* Easily create forms with aut...
aldeed:collection2       2.3.3  Automatic validation of inse...
coffeescript             1.0.6  Javascript dialect with fewe...
dsmtw-base               0.0.0+ dsmtw base functions
dsmtw-game               0.0.0+ dsmtw game settings
dsmtw-lib                0.0.0+ dsmtw lib functions
dsmtw-schemas            0.0.0+ dsmtw base schemas
dsmtw-theme              0.0.0+ dsmtw base theme
dsmtw-user               0.0.0+ dsmtw user related functions
ian:bootstrap-3          3.3.1  HTML, CSS, and JS framework ...
jquery                   1.11.3_2  Manipulate the DOM using ...
less                     1.0.14  The dynamic stylesheet lang...
meteor-platform          1.2.2  Include a standard set of Me...
meteorhacks:fast-render  2.3.2  Render you app even before t...
mizzao:timesync          0.3.1  NTP-style time synchronizati...
mizzao:user-status       0.6.4  User connection and idle sta...
momentjs:moment          2.10.2  Moment.js (official): parse...
naxio:flash              0.2.3  Simple Flash messages for Me...
reactive-var             1.0.5  Reactive variable
sacha:spin               2.0.4  Simple spinner package for M...
underscore               1.0.3  Collection of small helpers:...
useraccounts:bootstrap   1.8.1  Accounts Templates styled fo...
useraccounts:core        1.8.1  Meteor sign up and sign in t...

Thanks for the help guys!


#2

You probably tried this already, but just in case not, does ‘meteor reset’ help?


#3

:smile: yep tried that, not really helping.


#4

I found a simillar problem here. But after reading it, I still couldn’t figure it out. My mongo version is 2.6.7.
I used the collection2 successfully on another project (same local machine and versions)`

[UPDATE]

The problem was that i am using _id in my simple schema definition:

Schemas.Base = new SimpleSchema
  _id:
    type: String
    index: true
    unique: true
    regEx: SimpleSchema.RegEx.Id
    autoValue: ->
      if @isInsert
        (if @isSet then @value else Random.id())
      else
        @unset()
    autoform:
      omit: true