Skip to content

id mapping does not work? #11

@akralj

Description

@akralj

Hi,
my frontend requires a "id" to come from the rest service. I tried all sorts of different options to map _id to id, but no avail. i tried it with 1.3 and 2.0.1. I can do it with before and after hooks, but because you put it in the docs i'm assuming it should be handled by feathers-nedb. Is this assumption correct?
here is my code with feathers-nedb 1.3:

# app.js
feathers = require('feathers')
nedb = require('feathers-nedb')
bodyParser = require('body-parser')
hooks = require("feathers-hooks")
# Initialize NEDB CRUD database service
todos = nedb('todos', {id: "id"})
# A Feathers app is the same as an Express app
app = feathers().configure(hooks())
.use(feathers.static('./server/public')) # __dirname
# Add REST API support
app.configure feathers.rest()
# Configure Socket.io real-time APIs
app.configure feathers.socketio()
# Parse HTTP JSON bodies
app.use bodyParser.json()
# Register the todo service
app.use '/todos', todos
# Start the server
app.listen 3333

and the result of a get request http://localhost:3333/todos/EMVqs9KyTImCIKyE

{
"_id": "EMVqs9KyTImCIKyE",
"text": "A todo",
"complete": false
}

Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions