Collection
4 methods驱动和 mongo shell 暴露的集合级操作。
apiVersion: <group>/<version>向集合中插入单个文档。
Parameters
| Name | Type | Description |
|---|---|---|
| group | string | API group; core resources omit the group prefix. |
| version | string | Stable version such as v1, beta1. |
Returns
void
Example
kubernetes
apiVersion: apps/v1kind: <Kind>返回匹配查询的文档游标,可选投影字段。
Parameters
| Name | Type | Description |
|---|---|---|
| Kind | string | PascalCase resource kind. |
Returns
void
Example
kubernetes
kind: Deploymentmetadata:
name: <string>
namespace: <string>
labels: <map>使用 $set 等更新操作符更新匹配 filter 的第一个文档。
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | Unique name within the namespace. |
| namespace | string | Namespace; defaults to 'default'. |
| labels | map<string,string> | Key/value pairs for selection and grouping. |
Returns
void
Example
kubernetes
metadata:
name: nginx
namespace: web
labels:
app: nginxspec: <resource-specific-schema>删除匹配 filter 的第一个文档。
Parameters
| Name | Type | Description |
|---|---|---|
| schema | object | Kind-specific spec, e.g. containers for a Pod. |
Returns
void
Example
kubernetes
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
spec:
containers:
- name: nginx
image: nginx:1.27