Return object after delete collection


#1

When i’m deleting one collection in my MongoDB, i’m receiving this output:

{ result: 
   { ok: 1,
     n: 1,
     lastOp: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1448429280 },
     electionId: 562020eaa64d1ba4e7af6f2a },
  connection: 
   EventEmitter {
     domain: null,
     _events: 
      { close: [Object],
        error: [Object],
        timeout: [Object],
        parseError: [Object],
        connect: [Function] },
     _eventsCount: 5,
     _maxListeners: undefined,
     options: 
      { socketOptions: {},
        auto_reconnect: true,
        host: 'ds053698.mongolab.com',
        port: 53698,
        cursorFactory: [Object],
        reconnect: true,
        emitError: true,
        size: 5,
        disconnectHandler: [Object],
        bson: {},
        messageHandler: [Function],
        wireProtocolHandler: {} },
     id: 3,
     logger: { className: 'Connection' },
     bson: {},
     tag: undefined,
     messageHandler: [Function],
     maxBsonMessageSize: 67108864,
     port: 53698,
     host: 'ds053698.mongolab.com',
     keepAlive: true,
     keepAliveInitialDelay: 0,
     noDelay: true,
     connectionTimeout: 0,
     socketTimeout: 0,
     destroyed: false,
     domainSocket: false,
     singleBufferSerializtion: true,
     serializationFunction: 'toBinUnified',
     ca: null,
     cert: null,
     key: null,
     passphrase: null,
     ssl: false,
     rejectUnauthorized: false,
     responseOptions: { promoteLongs: true },
     flushing: false,
     queue: [],
     connection: 
      Socket {
        _connecting: false,
        _hadError: false,
        _handle: [Object],
        _parent: null,
        _host: 'ds053698.mongolab.com',
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _eventsCount: 8,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: false,
        destroyed: false,
        bytesRead: 509,
        _bytesDispatched: 682,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        read: [Function],
        _consuming: true },
     writeStream: null,
     buffer: null,
     sizeOfMessage: 0,
     bytesRead: 0,
     stubBuffer: null } }

And ember is complaining about it. When i delete, the delete will happen… but will also pop up this error:

TypeError: Cannot read property 'replace' of undefined
    at Object.func (ember.debug.js:39371)
    at Object.Cache.get (ember.debug.js:13297)
    at decamelize (ember.debug.js:39408)
    at Object.func (ember.debug.js:39328)
    at Object.Cache.get (ember.debug.js:13297)
    at Object.dasherize (ember.debug.js:39412)
    at ember$data$lib$system$normalize$model$name$$normalizeModelName (normalize-model-name.js:13)
    at ember$data$lib$serializers$json$serializer$$default.extend.modelNameFromPayloadKey (json-api-serializer.js:272)
    at ember$data$lib$serializers$json$serializer$$default.extend._normalizeResourceHelper (json-api-serializer.js:149)
    at ember$data$lib$serializers$json$serializer$$default.extend._normalizeDocumentHelper (json-api-serializer.js:118)

And the return response is:

{"data":{"ok":1,"n":1,"lastOp":"6220957784033198081","electionId":"562020eaa64d1ba4e7af6f2a"}}

This is happening when i try to edit, too.

What should me the response object? Is this wrong??

Thanks guys.


#2

What Ember Data serializer are you using?


#3

Hei!

I was able to fix it. Can this post be deleted?

Thanks anyway.


#4

This post shouldn’t be deleted, and if you don’t mind please share how you solve this problem, so others can find answer if they encounter the same.


#5

I don’t, but i believe my problem was not related to ember. My API was sending wrong response for POST and DELETE requests.

POST -> Send new object
DELETE -> Send just 404 response