I have this simple schema:
var CategorySchema = new mongoose.Schema({
name: String,
description: String
});
I get id as URL parameter:
var id = req.params.id;
Category.findById(id, function(err, blogshop){
...
});
Do I need to use mongoose.Schema.Types.ObjectId; or passing the hex value is ok? Thanks
from the documentation
id <ObjectId, HexId> objectid, or a value that can be casted to one
you can simply put string of id