Node.js环境中MongoDB设置自增主键并获取主键
MongoDB本身没有自增主键设置,这里借助另外一个文档用于保存自增主键。const mongoose = require('mongoose');const DB_URL = "mongodb://localhost/test";mongoose.connect(DB_URL, { useNewUrlParser: true });mongoose.Promise = Promise...
原创
2019-04-11 20:08:00 ·
2443 阅读 ·
1 评论