# @appveen/swagger-mongoose-crud 中文文档

规范地址：https://npmcn.com/package/%40appveen/swagger-mongoose-crud/

版本：6\.13\.10
npm 元数据更新时间：2025-10-10T13:24:52.677Z
中文译文更新时间：2026-11-06T12:47:44.076Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40appveen/swagger-mongoose-crud
原文对照：https://npmcn.com/package/%40appveen/swagger-mongoose-crud/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：57.1 kB，12 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：2 个
- 首次发布：2018-11-15T05:45:24.288Z
- 最新版本发布：2025-10-10T13:24:52.512Z
- 近 30 天下载量：4148（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：28（近 12 个月 0 个）

## 中文简介

卷发被子

## 安装

```sh
npm install @appveen/swagger-mongoose-crud
```

也可以使用：`pnpm add @appveen/swagger-mongoose-crud`、`yarn add @appveen/swagger-mongoose-crud`、`bun add @appveen/swagger-mongoose-crud`

## README

# 摇摇欲坠

[![Build Status](https://travis-ci.org/appveen/swagger-mongoose-crud.svg?branch=master)](https://travis-ci.org/appveen/swagger-mongoose-crud)

用于 Swagger 的 mongoose CRUD 操作的简单包装器 。 这个插件是Mongoose CRUD操作的调制版本,由 [迈克尔·克龙](https://github.com/michaelkrone)。 。 。 .

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

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

## 安装

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

## 使用量

```javascript
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 是什么？

卷发被子

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

