Skip to content

Keys are not being parsed has ObjectId #1217

@cossou

Description

@cossou

Hi guys,

I have the following scenario.
I made a GET to the following address: /accounts/{id}/apps/{fk}

With the id and fk
id: 54dc9dec466d681300289184
fk: 550715659866120300128497 (ObjectId but its also Integer)

I'm using Mongo and both id and fk were auto generated.

The result from the API:

{
  "error": {
    "name": "Error",
    "status": 404,
    "message": "No instance with id 5.507156598661203e+23 found for App",
    "statusCode": 404
  }
}

My App model:

{
  "name": "App",
  "plural": "apps",
  "base": "PersistedModel",
  "idInjection": true,
  "properties": {
    "name": {
      "type": "string",
      "required": true
    },
    "appId": {
      "type": "string",
      "required": false,
      "index": {
        "unique": true
      }
    },
    "active": {
      "type": "boolean",
      "default": true
    },
    "created": {
      "type": "date"
    },
    "modified": {
      "type": "date"
    }
  },
  "validations": [],
  "relations": {
    "account": {
      "type": "belongsTo",
      "model": "Account",
      "foreignKey": ""
    }
  },
  "acls": [],
  "methods": []
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions