我正在使用Express和Mongoose构建一个经典的Todo服务器。这是我的模型:
import mongoose = require('mongoose');
const autoIncrement = require('mongoose-sequence')(mongoose);
const TodoSchema: mongoose.Schema = new mongoose.Schema({
todoid: {
type: Number
},
title: {
type: String,
required: 'Enter a title'
},
note: {
type: String
},
complete: {
type: Boolean,
default: false
},
editMode: {
type: Boolean,
default: false
}
});
TodoSchema.plugin(autoIncrement, {
inc_field: 'todoid',
start_seq: 422
});
export { TodoSchema };
http://localhost:3000/todos?complete=true
我可以
FindOne
正确的方法是什么?