You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var ContentTagSchema = new mongoose.Schema({
_id: { type : String, lowercase: true, required: true, index: true, unique: true},
description: String
});
module.exports = restful.model('ContentTag', ContentTagSchema);
This is my register file for routes:
var ContentTag = require('../models/ContentTagSchema');
ContentTag.methods(['get', 'put', 'post', 'delete']);
ContentTag.register(router, '/api/v2/content/tags');
ContentTag.on('index', function(err) {
if (err) {
console.error('ContentTag index error: %s', err);
} else {
console.info('ContentTag indexing complete');
}
});
Result:
DELETE /api/v2/content/tags/jon 404 2.188 ms - 1795
Error: Not Found
at /DIR/api/v2/xxx.js:53:13
at Layer.handle [as handle_request] (/DIR/api/v2/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/DIR/ [......]
Ok. I've figure out. The "problem" or feature is in the model.js file in the registerRoutes function where you filter the _id route to ([0-9a-fA-F]{0,24}$). I removed the line and now it's working.
This is my mongoose Schema in my model file:
This is my register file for routes:
Result:
Here is db.collection.find({}) from db:
Any idea? Thanks.
The text was updated successfully, but these errors were encountered: