@appveen/swagger-mongoose-crud

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

Swagger Mongoose crud wrapper

原始使用文档
文档目录4 节
  1. Installation
  2. Usage
  3. Fields added by this library to your schema
  4. Indexed fields

swagger-mongoose-crud

Build Status

A Simple wrapper for Swagger based mongoose CRUD operation. This plugin is a modfied version of the Mongoose CRUD operation introducted by Micheal Krone.

This module exposes following basic operations.

  • Create
  • Update
  • Read
  • Delete
  • Index (list)
  • Count
  • bulkUpdate
  • bulkUpload
  • bulkShow
  • markAsDeleted
  • rucc

Installation

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

Usage

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;

Fields added by this library to your schema

  • createdAt : Type Date. The time of creation of the document
  • lastUpdated : Type Date. The last updated time of the document
  • deleted : Type Boolean. This is false by default. The

Indexed fields

  • lastUpdated
  • createdAt .

版本与发布记录

@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 是什么?

Swagger Mongoose crud wrapper

如何安装 @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 和提交记录判断。