【发布时间】:2020-06-08 11:52:38
【问题描述】:
我想在客户端(角度)内的 bdd mongodb 中存储新集合我有一个表格要填写,当我点击提交时,一个新集合会像这样保存在 mongodb 中:
{
"id": "5ede1268f363436aae8e52b0",
"firstname": "adam",
"lastname": "nebli",
"email": "h@gmail.com"
}
我的问题是我想要一个不像那样的简单 id,因为我需要在我的编辑方法中使用它。我想创建一个这样的方法:
void editTemplate ( String id , Template temp) {
template = repo.findbyTempId(id);
template.setemail(temp.getemail());
template.setlastname(temp.getlastname());
}
如何设置 mongo 以创建具有简单 id 而不是 Objectid 的集合?
【问题讨论】:
标签: mongodb spring-boot