MongoDb returns ids of the form _id. I would like to make sure that the frontend (ember.js app) always receives id instead. I could write a serializer on the client, but I think there's probably a much easier solution that could either be implemented at the Database level or within the express server app.
I tried using virtual attributes, but this did'nt seem to work.
ActionSchema = mongoose.Schema(
title: type: mongoose.Schema.Types.Mixed
reduction: type: Number
description: type: mongoose.Schema.Types.Mixed
category: type: String
)
ActionSchema.virtual('id').get(->
@_id
)
Aucun commentaire:
Enregistrer un commentaire