Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 500 when duplicate field found #22

Open
castasamu opened this issue Mar 3, 2018 · 1 comment
Open

Error 500 when duplicate field found #22

castasamu opened this issue Mar 3, 2018 · 1 comment

Comments

@castasamu
Copy link

castasamu commented Mar 3, 2018

If I set unique value and try to insert a same value throwing an error 500

'slug': {
        type: String,
        unique: true
    },

Client Error:

Error: Internal server error [500]
    at Connection._livedata_result (http://localhost:3000/packages/ddp-client.js?hash=69c1d15adcf9b913cb4704b652adeff4bc462aa8:1975:25)
    at Connection.onMessage (http://localhost:3000/packages/ddp-client.js?hash=69c1d15adcf9b913cb4704b652adeff4bc462aa8:2169:14)
    at http://localhost:3000/packages/socket-stream-client.js?hash=7063aa833005aff7419b3f8c222e877582f1a3e0:262:13
    at Array.forEach (<anonymous>)
    at ClientStream.forEachCallback (http://localhost:3000/packages/socket-stream-client.js?hash=7063aa833005aff7419b3f8c222e877582f1a3e0:353:33)
    at SockJS.socket.onmessage (http://localhost:3000/packages/socket-stream-client.js?hash=7063aa833005aff7419b3f8c222e877582f1a3e0:261:18)
    at SockJS.REventTarget.dispatchEvent (http://localhost:3000/packages/socket-stream-client.js?hash=7063aa833005aff7419b3f8c222e877582f1a3e0:641:22)
    at SockJS._dispatchMessage (http://localhost:3000/packages/socket-stream-client.js?hash=7063aa833005aff7419b3f8c222e877582f1a3e0:1820:10)
    at SockJS._didMessage (http://localhost:3000/packages/socket-stream-client.js?hash=7063aa833005aff7419b3f8c222e877582f1a3e0:1886:16)
    at WebSocket.that.ws.onmessage (http://localhost:3000/packages/socket-stream-client.js?hash=7063aa833005aff7419b3f8c222e877582f1a3e0:2044:15)

Server error:

 Exception while invoking method 'categories.update' MongoError: E11000 duplicate key error collection: meteor.category index: c2_slugIt dup key: { : "prova" }
     at Function.MongoError.create (/Users/user/.meteor/packages/npm-mongo/.2.2.33.1b95sy0++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/error.js:31:11)
     at toError (/Users/user/.meteor/packages/npm-mongo/.2.2.33.1b95sy0++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/utils.js:139:22)
     at /Users/user/.meteor/packages/npm-mongo/.2.2.33.1b95sy0++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/collection.js:1059:67
     at /Users/user/.meteor/packages/npm-mongo/.2.2.33.1b95sy0++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/connection/pool.js:469:18
     at _combinedTickCallback (internal/process/next_tick.js:131:7)
     at process._tickDomainCallback (internal/process/next_tick.js:218:9)

How to manage this error?

I use:

"simpl-schema": "^1.4.2"
aldeed:collection2     3.0.0
aldeed:schema-index    3.0.0
@castasamu castasamu changed the title Hi, Error 500 when duplicate field found Mar 3, 2018
@castasamu
Copy link
Author

I expected to get an error kind so 400 'notUnique'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant