Im not sure why Schema.ObjectId is not working on my model, I have the latest version of mongoose.
this is my model
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;
var TeamSchema = new mongoose.Schema({
team_name : {
type: String,
index : true
},
dateCreated : {
type : Date
},
memberId : {
type : Schema.Types.ObjectId
}
});
var Team = module.exports = mongoose.model('Team', TeamSchema);
module.exports.createTeam = function(newTeam, callback){
newTeam.save(function(err){
if (err) throw err;
});
}
I also tried this post still not working. can anyone help on this? thanks
this is the json file of my data, and its weird the memberId is not showing
[
{
"_id": "587da4a9141f1619f42ac66d",
"dateCreated": "2017-01-17T04:59:21.000Z",
"team_name": "Sample Team",
"__v": 0
}
]