# Update Many

> Update multiple records in a collection based on specified criteria using API Maker's g.sys.db.updateMany method.

Source: https://docs.apimaker.dev/v4/examples/sys/db/updateMany.html

> **The code in every language**
>
> Each example is the inside of `main`, written in every [language](https://docs.apimaker.dev/v4/docs/languages/index.html) API Maker runs : pick yours in the tabs, and every page shows it from then on. The types a call takes (`GetAll`, `DeepItem`…) are those of `am` : `from am import GetAll` in Python, `use am::GetAll;` in Rust, `import am.GetAll;` in Java and Kotlin ; PHP and C# have them without an import, Go names them `am.GetAll`.

`g.sys.db.updateMany` calls the [update many schema API](https://docs.apimaker.dev/v4/docs/apis-all/schema-apis/auto-generated-schema-based-update-many-api.html) of any table from your code, with the same headers and query parameters as over HTTP. It returns the data. The whole envelope (`success`, `statusCode`, `data`, `totalCount`, `errors`…) comes back when `true` is passed as the second argument in TypeScript, and through `full` in the other languages : `g.sys.db.full` (`g.Sys.Db.Full` in C# and Go, `$g->sys->db->full` in PHP).

## Simple update-many

**TypeScript**

**Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "first_name": "Alice"
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Alice',
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Alice',
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Alice",
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"first_name": "Alice",
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Alice",
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Alice"
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Alice",
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## update-many with header

**TypeScript**

**Update many with header**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "first_name": "Alice"
    },
    updateData: {
        "first_name": "MALLORY"
    },
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
```

**Python**

**Update many with header**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'first_name': 'Alice',
    },
    update_data={
        'first_name': 'MALLORY',
    },
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
)
```

**PHP**

**Update many with header**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'first_name' => 'Alice',
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    ],
);
```

**C#**

**Update many with header**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Alice",
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    },
});
```

**Go**

**Update many with header**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"first_name": "Alice",
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
	Headers: am.M{
		"x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**Update many with header**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "first_name": "Alice",
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        }))
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        })),
)?;
```

**Java**

**Update many with header**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "first_name", "Alice"
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    ))
    .headers(Map.of(
        "x-am-response-case", "capitalCase" // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
    )));
```

**Kotlin**

**Update many with header**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "first_name" to "Alice",
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        )),
)
```

## $in update-many

**TypeScript**

**$in Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$in": [2, 3]
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$in Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$in': [2, 3],
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$in Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$in' => [2, 3],
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$in Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$in"] = new JsonArray { 2, 3 },
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$in Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": am.M{
			"$in": []any{2, 3},
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$in Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$in": [2, 3],
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$in Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$in", List.of(2, 3)
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$in Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$in" to listOf(2, 3),
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $nin update-many

**TypeScript**

**$nin Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$nin": [2, 3]
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$nin Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$nin': [2, 3],
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$nin Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$nin' => [2, 3],
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$nin Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$nin"] = new JsonArray { 2, 3 },
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$nin Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": am.M{
			"$nin": []any{2, 3},
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$nin Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$nin": [2, 3],
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$nin Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$nin", List.of(2, 3)
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$nin Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$nin" to listOf(2, 3),
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $and update-many

**TypeScript**

**$and Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        $and: [
            {
                "first_name": "Alice"
            },
            {
                "isActive": 1
            }
        ]
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$and Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        '$and': [
            {
                'first_name': 'Alice',
            },
            {
                'isActive': 1,
            },
        ],
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$and Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$and' => [
            [
                'first_name' => 'Alice',
            ],
            [
                'isActive' => 1,
            ],
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$and Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$and"] = new JsonArray
        {
            new JsonObject
            {
                ["first_name"] = "Alice",
            },
            new JsonObject
            {
                ["isActive"] = 1,
            },
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$and Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"$and": []any{
			am.M{
				"first_name": "Alice",
			},
			am.M{
				"isActive": 1,
			},
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$and Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$and": [
                {
                    "first_name": "Alice",
                },
                {
                    "isActive": 1,
                },
            ],
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$and Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$and", List.of(
            Map.of(
                "first_name", "Alice"
            ),
            Map.of(
                "isActive", 1
            )
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$and Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$and" to listOf(
                mapOf(
                    "first_name" to "Alice",
                ),
                mapOf(
                    "isActive" to 1,
                ),
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $or update-many

**TypeScript**

**$or Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        $or: [
            {
                "first_name": "Alice"
            },
            {
                "isActive": 1
            }
        ]
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$or Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        '$or': [
            {
                'first_name': 'Alice',
            },
            {
                'isActive': 1,
            },
        ],
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$or Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        '$or' => [
            [
                'first_name' => 'Alice',
            ],
            [
                'isActive' => 1,
            ],
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$or Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["$or"] = new JsonArray
        {
            new JsonObject
            {
                ["first_name"] = "Alice",
            },
            new JsonObject
            {
                ["isActive"] = 1,
            },
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$or Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"$or": []any{
			am.M{
				"first_name": "Alice",
			},
			am.M{
				"isActive": 1,
			},
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$or Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "$or": [
                {
                    "first_name": "Alice",
                },
                {
                    "isActive": 1,
                },
            ],
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$or Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "$or", List.of(
            Map.of(
                "first_name", "Alice"
            ),
            Map.of(
                "isActive", 1
            )
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$or Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "\$or" to listOf(
                mapOf(
                    "first_name" to "Alice",
                ),
                mapOf(
                    "isActive" to 1,
                ),
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $eq update-many

**TypeScript**

**$eq Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$eq": 2
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$eq Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$eq': 2,
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$eq Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$eq' => 2,
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$eq Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$eq"] = 2,
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$eq Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": am.M{
			"$eq": 2,
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$eq Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$eq": 2,
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$eq Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$eq", 2
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$eq Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$eq" to 2,
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $gt update-many

**TypeScript**

**$gt Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$gt": 2
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$gt Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$gt': 2,
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$gt Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$gt' => 2,
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$gt Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$gt"] = 2,
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$gt Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": am.M{
			"$gt": 2,
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$gt Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$gt": 2,
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$gt Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$gt", 2
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$gt Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$gt" to 2,
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $gte update-many

**TypeScript**

**$gte Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$gte": 2
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$gte Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$gte': 2,
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$gte Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$gte' => 2,
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$gte Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$gte"] = 2,
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$gte Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": am.M{
			"$gte": 2,
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$gte Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$gte": 2,
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$gte Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$gte", 2
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$gte Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$gte" to 2,
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $lt update-many

**TypeScript**

**$lt Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$lt": 2
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$lt Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$lt': 2,
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$lt Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$lt' => 2,
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$lt Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$lt"] = 2,
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$lt Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": am.M{
			"$lt": 2,
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$lt Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$lt": 2,
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$lt Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$lt", 2
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$lt Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$lt" to 2,
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## $lte update-many

**TypeScript**

**$lte Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": {
            "$lte": 2
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$lte Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': {
            '$lte': 2,
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$lte Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => [
            '$lte' => 2,
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$lte Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = new JsonObject
        {
            ["$lte"] = 2,
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$lte Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": am.M{
			"$lte": 2,
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$lte Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": {
                "$lte": 2,
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$lte Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", Map.of(
            "$lte", 2
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$lte Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to mapOf(
                "\$lte" to 2,
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## [mongoDB] update-many

**TypeScript**

**$mongoDB Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": 2,
        "ages.birth_year": "1889"
    },
    updateData: {
        "ages.$.age": "35"
    }
});
```

**Python**

**$mongoDB Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': 2,
        'ages.birth_year': '1889',
    },
    update_data={
        'ages.$.age': '35',
    },
)
```

**PHP**

**$mongoDB Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => 2,
        'ages.birth_year' => '1889',
    ],
    updateData: [
        'ages.$.age' => '35',
    ],
);
```

**C#**

**$mongoDB Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = 2,
        ["ages.birth_year"] = "1889",
    },
    UpdateData = new JsonObject
    {
        ["ages.$.age"] = "35",
    },
});
```

**Go**

**$mongoDB Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id":     2,
		"ages.birth_year": "1889",
	},
	UpdateData: am.M{
		"ages.$.age": "35",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$mongoDB Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": 2,
            "ages.birth_year": "1889",
        }))
        .update_data(json!({
            "ages.$.age": "35",
        })),
)?;
```

**Java**

**$mongoDB Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", 2,
        "ages.birth_year", "1889"
    ))
    .updateData(Map.of(
        "ages.$.age", "35"
    )));
```

**Kotlin**

**$mongoDB Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to 2,
            "ages.birth_year" to "1889",
        ))
        .updateData(mapOf(
            "ages.\$.age" to "35",
        )),
)
```

## [MongoDB] $elemMatch, $gte, $lte update-many

**TypeScript**

**$elemMatch, $gte, $lte Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "mysql_8", database: "inventory", collection: "customers",
    find: {
        "customer_id": 2,
        "ages": {
            "$elemMatch": {
                "age": {
                    "$gte": 30
                },
                "birth_year": {
                    "$lte": 1900
                }
            }
        }
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**$elemMatch, $gte, $lte Update many**

```python
update_many = await g.sys.db.update_many(
    'mysql_8', 'inventory', 'customers',
    find={
        'customer_id': 2,
        'ages': {
            '$elemMatch': {
                'age': {
                    '$gte': 30,
                },
                'birth_year': {
                    '$lte': 1900,
                },
            },
        },
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**$elemMatch, $gte, $lte Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'mysql_8', 'inventory', 'customers',
    find: [
        'customer_id' => 2,
        'ages' => [
            '$elemMatch' => [
                'age' => [
                    '$gte' => 30,
                ],
                'birth_year' => [
                    '$lte' => 1900,
                ],
            ],
        ],
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**$elemMatch, $gte, $lte Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("mysql_8", "inventory", "customers")
{
    Find = new JsonObject
    {
        ["customer_id"] = 2,
        ["ages"] = new JsonObject
        {
            ["$elemMatch"] = new JsonObject
            {
                ["age"] = new JsonObject
                {
                    ["$gte"] = 30,
                },
                ["birth_year"] = new JsonObject
                {
                    ["$lte"] = 1900,
                },
            },
        },
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**$elemMatch, $gte, $lte Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "mysql_8", Database: "inventory", Collection: "customers",
	Find: am.M{
		"customer_id": 2,
		"ages": am.M{
			"$elemMatch": am.M{
				"age": am.M{
					"$gte": 30,
				},
				"birth_year": am.M{
					"$lte": 1900,
				},
			},
		},
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**$elemMatch, $gte, $lte Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("mysql_8", "inventory", "customers")
        .find(json!({
            "customer_id": 2,
            "ages": {
                "$elemMatch": {
                    "age": {
                        "$gte": 30,
                    },
                    "birth_year": {
                        "$lte": 1900,
                    },
                },
            },
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**$elemMatch, $gte, $lte Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("mysql_8", "inventory", "customers")
    .find(Map.of(
        "customer_id", 2,
        "ages", Map.of(
            "$elemMatch", Map.of(
                "age", Map.of(
                    "$gte", 30
                ),
                "birth_year", Map.of(
                    "$lte", 1900
                )
            )
        )
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**$elemMatch, $gte, $lte Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("mysql_8", "inventory", "customers")
        .find(mapOf(
            "customer_id" to 2,
            "ages" to mapOf(
                "\$elemMatch" to mapOf(
                    "age" to mapOf(
                        "\$gte" to 30,
                    ),
                    "birth_year" to mapOf(
                        "\$lte" to 1900,
                    ),
                ),
            ),
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## Structure

**TypeScript**

**Update many**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "INSTANCE_NAME", database: 'DB_NAME', collection: "COLLECTION_NAME",
    find: {
        "COLUMN_NAME": "VALUE",
    },
    updateData: {
        "COLUMN_NAME": "VALUE",
    },
    headers: {
        "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type": "make_flat", // no_action | make_flat
        "x-am-meta": "true", // true, false
        "x-am-internationalization": "USER_I18N_ID",
        "x-am-run-in-sandbox": "2",
        "x-am-content-type-response": "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control": "reset_cache", // no_action | reset_cache
        "x-am-get-encrypted-data": "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout": "13000",
        "x-no-compression": "true", // true | false
        "x-am-encrypted-payload": "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization": "AUTHORIZATION_TOKEN",
        "x-am-user-authorization": "API_USER_TOKEN",
        "x-aws-authorization": "AWS_TOKEN",
        "x-google-authorization": "GOOGLE_TOKEN",
        "x-azure-authorization": "AZURE_TOKEN",
    },
});
```

**Python**

**Update many**

```python
update_many = await g.sys.db.update_many(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    find={
        'COLUMN_NAME': 'VALUE',
    },
    update_data={
        'COLUMN_NAME': 'VALUE',
    },
    headers={
        'x-am-response-case': 'capitalCase',  # noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        'x-am-response-object-type': 'make_flat',  # no_action | make_flat
        'x-am-meta': 'true',  # true, false
        'x-am-internationalization': 'USER_I18N_ID',
        'x-am-run-in-sandbox': '2',
        'x-am-content-type-response': 'text/xml',  # application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        'x-am-cache-control': 'reset_cache',  # no_action | reset_cache
        'x-am-get-encrypted-data': 'get_only_encryption',  # no_encryption | get_only_encryption | get_data_and_encryption
        'x-am-sandbox-timeout': '13000',
        'x-no-compression': 'true',  # true | false
        'x-am-encrypted-payload': 'true',  # user will send 'true', when payload is encrypted for transfer
        # Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username': 'TENANT_USERNAME',  # ex: acme
        # Authorization headers
        'x-am-authorization': 'AUTHORIZATION_TOKEN',
        'x-am-user-authorization': 'API_USER_TOKEN',
        'x-aws-authorization': 'AWS_TOKEN',
        'x-google-authorization': 'GOOGLE_TOKEN',
        'x-azure-authorization': 'AZURE_TOKEN',
    },
)
```

**PHP**

**Update many**

```php
$updateMany = $g->sys->db->updateMany(
    'INSTANCE_NAME', 'DB_NAME', 'COLLECTION_NAME',
    find: [
        'COLUMN_NAME' => 'VALUE',
    ],
    updateData: [
        'COLUMN_NAME' => 'VALUE',
    ],
    headers: [
        'x-am-response-case' => 'capitalCase', // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        'x-am-response-object-type' => 'make_flat', // no_action | make_flat
        'x-am-meta' => 'true', // true, false
        'x-am-internationalization' => 'USER_I18N_ID',
        'x-am-run-in-sandbox' => '2',
        'x-am-content-type-response' => 'text/xml', // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        'x-am-cache-control' => 'reset_cache', // no_action | reset_cache
        'x-am-get-encrypted-data' => 'get_only_encryption', // no_encryption | get_only_encryption | get_data_and_encryption
        'x-am-sandbox-timeout' => '13000',
        'x-no-compression' => 'true', // true | false
        'x-am-encrypted-payload' => 'true', // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        'x-am-tenant-username' => 'TENANT_USERNAME', // ex: acme
        // Authorization headers
        'x-am-authorization' => 'AUTHORIZATION_TOKEN',
        'x-am-user-authorization' => 'API_USER_TOKEN',
        'x-aws-authorization' => 'AWS_TOKEN',
        'x-google-authorization' => 'GOOGLE_TOKEN',
        'x-azure-authorization' => 'AZURE_TOKEN',
    ],
);
```

**C#**

**Update many**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
{
    Find = new JsonObject
    {
        ["COLUMN_NAME"] = "VALUE",
    },
    UpdateData = new JsonObject
    {
        ["COLUMN_NAME"] = "VALUE",
    },
    Headers = new JsonObject
    {
        ["x-am-response-case"] = "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        ["x-am-response-object-type"] = "make_flat", // no_action | make_flat
        ["x-am-meta"] = "true", // true, false
        ["x-am-internationalization"] = "USER_I18N_ID",
        ["x-am-run-in-sandbox"] = "2",
        ["x-am-content-type-response"] = "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        ["x-am-cache-control"] = "reset_cache", // no_action | reset_cache
        ["x-am-get-encrypted-data"] = "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        ["x-am-sandbox-timeout"] = "13000",
        ["x-no-compression"] = "true", // true | false
        ["x-am-encrypted-payload"] = "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        ["x-am-tenant-username"] = "TENANT_USERNAME", // ex: acme
        // Authorization headers
        ["x-am-authorization"] = "AUTHORIZATION_TOKEN",
        ["x-am-user-authorization"] = "API_USER_TOKEN",
        ["x-aws-authorization"] = "AWS_TOKEN",
        ["x-google-authorization"] = "GOOGLE_TOKEN",
        ["x-azure-authorization"] = "AZURE_TOKEN",
    },
});
```

**Go**

**Update many**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "INSTANCE_NAME", Database: "DB_NAME", Collection: "COLLECTION_NAME",
	Find: am.M{
		"COLUMN_NAME": "VALUE",
	},
	UpdateData: am.M{
		"COLUMN_NAME": "VALUE",
	},
	Headers: am.M{
		"x-am-response-case":         "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
		"x-am-response-object-type":  "make_flat",   // no_action | make_flat
		"x-am-meta":                  "true",        // true, false
		"x-am-internationalization":  "USER_I18N_ID",
		"x-am-run-in-sandbox":        "2",
		"x-am-content-type-response": "text/xml",            // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
		"x-am-cache-control":         "reset_cache",         // no_action | reset_cache
		"x-am-get-encrypted-data":    "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
		"x-am-sandbox-timeout":       "13000",
		"x-no-compression":           "true", // true | false
		"x-am-encrypted-payload":     "true", // user will send 'true', when payload is encrypted for transfer
		// Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
		"x-am-tenant-username": "TENANT_USERNAME", // ex: acme
		// Authorization headers
		"x-am-authorization":      "AUTHORIZATION_TOKEN",
		"x-am-user-authorization": "API_USER_TOKEN",
		"x-aws-authorization":     "AWS_TOKEN",
		"x-google-authorization":  "GOOGLE_TOKEN",
		"x-azure-authorization":   "AZURE_TOKEN",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**Update many**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
        .find(json!({
            "COLUMN_NAME": "VALUE",
        }))
        .update_data(json!({
            "COLUMN_NAME": "VALUE",
        }))
        .headers(json!({
            "x-am-response-case": "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
            "x-am-response-object-type": "make_flat", // no_action | make_flat
            "x-am-meta": "true", // true, false
            "x-am-internationalization": "USER_I18N_ID",
            "x-am-run-in-sandbox": "2",
            "x-am-content-type-response": "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
            "x-am-cache-control": "reset_cache", // no_action | reset_cache
            "x-am-get-encrypted-data": "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
            "x-am-sandbox-timeout": "13000",
            "x-no-compression": "true", // true | false
            "x-am-encrypted-payload": "true", // user will send 'true', when payload is encrypted for transfer
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username": "TENANT_USERNAME", // ex: acme
            // Authorization headers
            "x-am-authorization": "AUTHORIZATION_TOKEN",
            "x-am-user-authorization": "API_USER_TOKEN",
            "x-aws-authorization": "AWS_TOKEN",
            "x-google-authorization": "GOOGLE_TOKEN",
            "x-azure-authorization": "AZURE_TOKEN",
        })),
)?;
```

**Java**

**Update many**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
    .find(Map.of(
        "COLUMN_NAME", "VALUE"
    ))
    .updateData(Map.of(
        "COLUMN_NAME", "VALUE"
    ))
    .headers(JsonObject.of(
        "x-am-response-case", "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
        "x-am-response-object-type", "make_flat", // no_action | make_flat
        "x-am-meta", "true", // true, false
        "x-am-internationalization", "USER_I18N_ID",
        "x-am-run-in-sandbox", "2",
        "x-am-content-type-response", "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
        "x-am-cache-control", "reset_cache", // no_action | reset_cache
        "x-am-get-encrypted-data", "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
        "x-am-sandbox-timeout", "13000",
        "x-no-compression", "true", // true | false
        "x-am-encrypted-payload", "true", // user will send 'true', when payload is encrypted for transfer
        // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
        "x-am-tenant-username", "TENANT_USERNAME", // ex: acme
        // Authorization headers
        "x-am-authorization", "AUTHORIZATION_TOKEN",
        "x-am-user-authorization", "API_USER_TOKEN",
        "x-aws-authorization", "AWS_TOKEN",
        "x-google-authorization", "GOOGLE_TOKEN",
        "x-azure-authorization", "AZURE_TOKEN"
    )));
```

**Kotlin**

**Update many**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("INSTANCE_NAME", "DB_NAME", "COLLECTION_NAME")
        .find(mapOf(
            "COLUMN_NAME" to "VALUE",
        ))
        .updateData(mapOf(
            "COLUMN_NAME" to "VALUE",
        ))
        .headers(mapOf(
            "x-am-response-case" to "capitalCase", // noChange | camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase
            "x-am-response-object-type" to "make_flat", // no_action | make_flat
            "x-am-meta" to "true", // true, false
            "x-am-internationalization" to "USER_I18N_ID",
            "x-am-run-in-sandbox" to "2",
            "x-am-content-type-response" to "text/xml", // application/json | text/xml | text/yaml | text/plain | text/html | application/octet-stream
            "x-am-cache-control" to "reset_cache", // no_action | reset_cache
            "x-am-get-encrypted-data" to "get_only_encryption", // no_encryption | get_only_encryption | get_data_and_encryption
            "x-am-sandbox-timeout" to "13000",
            "x-no-compression" to "true", // true | false
            "x-am-encrypted-payload" to "true", // user will send 'true', when payload is encrypted for transfer
            // Multi-tenant : the tenant of the request, each instance finds it in its own tenants table
            "x-am-tenant-username" to "TENANT_USERNAME", // ex: acme
            // Authorization headers
            "x-am-authorization" to "AUTHORIZATION_TOKEN",
            "x-am-user-authorization" to "API_USER_TOKEN",
            "x-aws-authorization" to "AWS_TOKEN",
            "x-google-authorization" to "GOOGLE_TOKEN",
            "x-azure-authorization" to "AZURE_TOKEN",
        )),
)
```

## Multi-tenant
- `instance: "crm::acme"` works on the database of the tenant `acme` of the [multi-tenant](https://docs.apimaker.dev/v4/docs/features/multi-tenant.html) instance `crm`.
- With `instance: "crm"`, the call works on the database of the tenant of the request: a custom API called with the [x-am-tenant-username](https://docs.apimaker.dev/v4/docs/apis-all/header/requestHeader.html#x-am-tenant-username) header passes it on to the APIs it calls. A request without a tenant works on the structure database.

**TypeScript**

**Update many customers of the tenant acme**

```typescript
let updateMany = await g.sys.db.updateMany({
    instance: "crm::acme", database: "crm", collection: "customers",
    find: {
        "first_name": "Alice"
    },
    updateData: {
        "first_name": "MALLORY"
    }
});
```

**Python**

**Update many customers of the tenant acme**

```python
update_many = await g.sys.db.update_many(
    'crm::acme', 'crm', 'customers',
    find={
        'first_name': 'Alice',
    },
    update_data={
        'first_name': 'MALLORY',
    },
)
```

**PHP**

**Update many customers of the tenant acme**

```php
$updateMany = $g->sys->db->updateMany(
    'crm::acme', 'crm', 'customers',
    find: [
        'first_name' => 'Alice',
    ],
    updateData: [
        'first_name' => 'MALLORY',
    ],
);
```

**C#**

**Update many customers of the tenant acme**

```csharp
var updateMany = await g.Sys.Db.UpdateMany(new UpdateMany("crm::acme", "crm", "customers")
{
    Find = new JsonObject
    {
        ["first_name"] = "Alice",
    },
    UpdateData = new JsonObject
    {
        ["first_name"] = "MALLORY",
    },
});
```

**Go**

**Update many customers of the tenant acme**

```go
updateMany, err := g.Sys.Db.UpdateMany(am.UpdateMany{
	Instance: "crm::acme", Database: "crm", Collection: "customers",
	Find: am.M{
		"first_name": "Alice",
	},
	UpdateData: am.M{
		"first_name": "MALLORY",
	},
})
if err != nil {
	return nil, err
}
```

**Rust**

**Update many customers of the tenant acme**

```rust
let update_many = g.sys.db.update_many(
    UpdateMany::new("crm::acme", "crm", "customers")
        .find(json!({
            "first_name": "Alice",
        }))
        .update_data(json!({
            "first_name": "MALLORY",
        })),
)?;
```

**Java**

**Update many customers of the tenant acme**

```java
var updateMany = g.sys.db.updateMany(new UpdateMany("crm::acme", "crm", "customers")
    .find(Map.of(
        "first_name", "Alice"
    ))
    .updateData(Map.of(
        "first_name", "MALLORY"
    )));
```

**Kotlin**

**Update many customers of the tenant acme**

```kotlin
val updateMany = g.sys.db.updateMany(
    UpdateMany("crm::acme", "crm", "customers")
        .find(mapOf(
            "first_name" to "Alice",
        ))
        .updateData(mapOf(
            "first_name" to "MALLORY",
        )),
)
```

## Without a schema

`g.sys.db.gen.updateManyGen` takes the same arguments and calls the [update many generated API](https://docs.apimaker.dev/v4/docs/apis-all/schema-apis/auto-generated-schema-based-update-many-api.html#without-a-schema) : no schema, so the data is read and written as it is in the table, without the conversions, validations and defaults of the schema.

| Language | The call |
|---|---|
| TypeScript | `g.sys.db.gen.updateManyGen(…)` |
| Python | `g.sys.db.gen.update_many_gen(…)` |
| PHP | `$g->sys->db->gen->updateManyGen(…)` |
| C#, Go | `g.Sys.Db.Gen.UpdateManyGen(…)` |
| Rust | `g.sys.db.update_many_gen(UpdateMany::new(…))` |
| Java, Kotlin | `g.sys.db.gen.updateManyGen(…)` |

## Related

- [Update many API](https://docs.apimaker.dev/v4/docs/apis-all/schema-apis/auto-generated-schema-based-update-many-api.html) · [Generated API from code](https://docs.apimaker.dev/v4/examples/sys/db/updateMany.html#without-a-schema) · [The global object g](https://docs.apimaker.dev/v4/docs/pre-defined-terms/global-object-g.html)
