mercredi 25 novembre 2015

Cannot read property 'replace' of undefined API with ember

I'm receiving the following error when i try to edit and delete a record in Ember:

Cannot read property 'replace' of undefined

I'm using an API to GET, GET ALL, CREATE, UPDATE and DELETE.

The GET, GET ALL and UPDATE is working pretty fine, but the rest is throwing this error.. I was searching and i found out that my response object is wrong.. but i'm just returning what Mongoose is returning to me:

When i delete:

{ result: 
   { ok: 1,
     n: 1,
     lastOp: Timestamp { _bsontype: 'Timestamp', low_: 1, high_: 1448505478 },
     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: 4,
     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 } }

When i update:

{ ok: 0, n: 0, nModified: 0 }

Thank you!!




Aucun commentaire:

Enregistrer un commentaire