I have this snippet of code in my app.js that adds a new region object to an array:
Countries = new Mongo.Collection('countries');
// Some skipped code
$scope.addRegion = function(newRegion) {
$scope.country.regions.push(
{
name: newRegion.name,
createdAt: new Date()
}
);
};
While this successfully adds new regions and persists them in the database, it lacks an "_id" field. How can I generate a unique id for each insertion (unique in the database)?