法
法丝 的博客
cqcqcq,这里是BG7ZAG,会coding的HAM,分享生活趣事、建站技术、前端开发、汽车相关、deepin系统、业余无线电等!73!
主页
帖子
博客广场
站点首页
最新博文
Mongoose二级连表查询
首先定义两个Schema,然后 model ; DB.js // 分类 let CategorieSchema = new mongoose.Schema({ "name" : String, "img" : String, "date": Date }); CategorieSchema...
2026-09-17
👁 13
💬 0
MongoDB
Mongoose
Mongoose 分页
Mongoose 分页查询: 在Schema中创建静态方法: // 分页 CategorieSchema.statics = { fetch(id, cb) { if (id) { return this.find({'_id': {"$lt": id}}) .limit(5) ....
2026-09-17
👁 12
💬 0
Mongoose
分页
mongoose SchemaFactory 设置createdAt、updatedAt为时间戳
@Schema({ timestamps: { currentTime: () => Date.now(), // 根据官方文档写法 }, }) export class Schema extends Document { ... @Prop() createdAt: number; // 需...
2026-09-17
👁 14
💬 0
createdAt
Mongo
MongoDB
Mongoose
updatedAt
法丝 的博客
博客广场
站点首页
© 2026 法丝 的博客 · Powered by 678PDF