@appveen/swagger-mongoose-crud

中文文档
6.13.10发布于 2025/10/10MITCommonJS近 30 天下载 4148

卷发被子

中文使用文档
文档目录4 节
  1. 安装
  2. 使用量
  3. 此库添加到您的计划中的字段
  4. 索引字段

摇摇欲坠

Build Status

用于 Swagger 的 mongoose CRUD 操作的简单包装器 。 这个插件是Mongoose CRUD操作的调制版本,由 迈克尔·克龙。 。 。 .

这个模块暴露在基本操作之后.

  • 创建
  • 更新
  • 读取
  • 删除
  • 索引(列表)
  • 计数
  • 更新日期
  • 散装负荷
  • 批量显示
  • 标记已删除
  • 吕克

安装

npm install @appveen/swagger-mongoose-crud --save

使用量

var Mongoose = require('@datanimbus/mongoose');
var SMCrud = require('swagger-mongoose-crud');
//In your controller, simply expose the following
var schema = new Mongoose.Schema({ 
    //Your mongoose Schema definition here.
});
var modelName = "Your model Name";
var options = {
 collectionName: "name of your collection",
 logger: "your logger object",
 defaultFilter: "default filter object for all read operations",
 permanentDeleteData: "To be set true, when soft delete is disabled"
}

var crud = new SMCrud(schema,modelName, options);
var exports = {};

//Takes all parameters for creating an entry
exports.create = crud.create; 

//Takes parameter 'id' for searching in the DB, will update rest of the parameters.
exports.update = crud.update;

//Will list out the entire collection, No parameters
exports.index = crud.index;

//Will mark the entity as deleted by setting deleted flag to true, takes 'id'
exports.markAsDeleted = crud.markAsDeleted;

//Will delete the entity, takes 'id'
exports.destroy = crud.destroy;

//Will show a single entity, takes 'id'
exports.show = crud.show;

//Will count the number of entries in the DB, Supports filter options.
exports.count = crud.count;

//Will update multiple document, takes comma separated 'id'
exports.bulkUpdate = crud.bulkUpdate;

//Will create multiple documents, takes file with comma separated data
exports.bulkUpload = crud.bulkUpload;

//Will show multiple entity, takes comma separated 'id'
exports.bulkShow = crud.bulkShow;

// Will ensure consistency when there are multiple parallel updates expected on the same document. This module is partially incomplete.
exports.rucc = crud.rucc; 

//crud.model will hold the Mongoose Model.
//crud.schema will hold the schema passed on at constructor
crud.select = [ 
    //list of the fields for the listing in Index call
];

crud.omit = [
    //list of the fields to disallow for Index search
];

module.exports = exports;

此库添加到您的计划中的字段

  • 创建到 : 类型 日期. 创建文件的时间
  • 上次更新 : 类型 日期。文档的最后更新时间
  • 删除 : 类型 布尔。这默认是错误的。 这个

索引字段

  • 上次更新
  • 创建到 。 。 。 .

版本与发布记录

@appveen/swagger-mongoose-crud 共发布 28 个版本,首次发布于 2018/11/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
6.13.10latest2025/10/101.1 年前
2.0.12022/09/274 年前
2.0.02022/09/164 年前
1.2.92022/04/194 年前
1.2.82022/04/164 年前
1.2.72022/04/124 年前

关于 @appveen/swagger-mongoose-crud 的常见问题

@appveen/swagger-mongoose-crud 是什么?

卷发被子

如何安装 @appveen/swagger-mongoose-crud?

在项目目录运行 npm install @appveen/swagger-mongoose-crud,或使用 pnpm add / yarn add / bun add。

@appveen/swagger-mongoose-crud 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/appveen__swagger-mongoose-crud 是否存在。

@appveen/swagger-mongoose-crud 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@appveen/swagger-mongoose-crud 可以商用吗?

@appveen/swagger-mongoose-crud 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@appveen/swagger-mongoose-crud 的下载量有多少?

根据 npm 官方下载统计,@appveen/swagger-mongoose-crud 在 2026/10/07 – 2026/11/05 这 30 天内被下载 4,148 次,日均约 138 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@appveen/swagger-mongoose-crud 还在维护吗?

最新版本 6.13.10 发布于 2025/10/10(1.1 年前);至今共发布 28 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/11/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。