# منغولديد

Canonical URL: https://developers.iagenify.com/ar/sdk/ref/providers/mongodb/
Language: ar

`api.storage.connect({ type: "database", provider: "mongodb", endpoint })`

٩ افعال قراءة ، ٤ اعمال كتابة ، ومجموعات ما تملكون من معلومات ، لا شيء يُعاد تسميته ولا يُهاجر .

Status: type: database · 9 reads · 4 writes · connection pooled

هذه أغنى من موفري الخدمات المترابطين، والواحدة التي كانت أدوات الوكيل تتشكل حولها: قاعدة بيانات لم يرها من قبل يمكن رسمها، واستجوابها وكتابتها بدون إعلان مخطط في أي مكان.

## هذا {#connect}

```javascript
const db = await api.storage.connect({
  label: "Production",
  type: "database",
  provider: "mongodb",
  endpoint: { credentials: { uri: "mongodb+srv://user:password@cluster.example.net/shop" } },
});
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `credentials.uri` | string | مطلوب | سلسلة الاتصال. إنها تحمل كلمة المرور، لذا تنتمي إلى `credentials`التي تشفر في الراحة |

> **اسم القاعدة هو مسار URI**
>
> …/shop هو ما يختار قاعدة البيانات. URI وهذا هو التفسير المعتاد لـ : « مجموعتي مفقودة » .

## ما الذي يُقبل منه هذا {#actions}

| الإجراء | قراءات أو كتابات | الاحتياجات إلى جمع البيانات |
| --- | --- | --- |
| [لمحة](/ar/sdk/ref/connected-storage/run/overview) | (ب) تشمل تكاليف السفر في مهام رسمية. | لا: |
| [(الجمعات)](/ar/sdk/ref/connected-storage/run/collections) | (ب) تشمل تكاليف السفر في مهام رسمية. | لا: |
| [الفترة](/ar/sdk/ref/connected-storage/run/schema) | (ب) تشمل تكاليف السفر في مهام رسمية. | نعم |
| [جد جد](/ar/sdk/ref/connected-storage/run/find) | (ب) تشمل تكاليف السفر في مهام رسمية. | نعم |
| [عدد](/ar/sdk/ref/connected-storage/run/count) | (ب) تشمل تكاليف السفر في مهام رسمية. | نعم |
| [المجموع](/ar/sdk/ref/connected-storage/run/aggregate) | (ب) تشمل تكاليف السفر في مهام رسمية. | نعم |
| [& لا شيء](/ar/sdk/ref/connected-storage/run/search) | (ب) تشمل تكاليف السفر في مهام رسمية. | لا: |
| [ما يلي:](/ar/sdk/ref/connected-storage/run-write/insert) | كتابة كتابة | نعم |
| [المستكمل](/ar/sdk/ref/connected-storage/run-write/update) | كتابة كتابة | نعم |
| [تحذف عبارة](/ar/sdk/ref/connected-storage/run-write/delete) | كتابة كتابة | نعم |
| [هذا](/ar/sdk/ref/connected-storage/run-write/save) | كتابة كتابة | نعم |
| [هذا](/ar/sdk/ref/connected-storage/run-write/create-collection) | كتابة كتابة | نعم |
| [C](/ar/sdk/ref/connected-storage/run-write/drop-collection) | كتابة كتابة | نعم |

Anything else raises `Action MongoDB inconnue`. `tables`, `execute`, `list`, `object` and `upload` belong to other providers.

## _id may be a string {#objectid}

An identifier written as a 24-character string is turned into an ObjectId wherever one is expected: direct equality, `$in`, `$nin` and `$ne`. That is what lets an identifier travel through JSON — out of a `find`, into a form, back into an `update` — without a cast of yours in between.

```javascript
const [order] = await db.run({ action: "find", collection: "orders", options: { limit: 1 } });

// order._id arrived as a string; it goes back as one
await db.run({
  action: "update",
  collection: "orders",
  filter: { _id: order._id },
  update: { $set: { status: "shipped" } },
});
```

## رفض رفض 5 من المشغلين خمسة {#refused}

`$where`, `$function` and `$accumulator` run JavaScript inside the database; `$out` and `$merge` write somewhere other than where you are looking. All five are refused on `find`, `count`, `update`, `delete` and `aggregate`, by inspecting the filter or the pipeline you sent.

```javascript
await db.run({ action: "find", collection: "users", filter: { $where: "this.age > 30" } });
// Error: find : l'operateur $where n'est pas autorise.
```

## الحدود التي فرضت على {#limits}

| شيء | الحد |
| --- | --- |
| `aggregate` ( | الوثائق |
| `aggregate` and `count` duration | 30 ثانية |
| `insert` ألف من الفئة | ١ الى ٥٠٠ ١ وثيقة |
| `overview` | 30 جمعا، و 25 حقل، و عينة واحدة لكل من |
| `schema` | وثائق مجلس الأمن المنشأة مؤخرا |

## يجري إجراء {#empty-filter}

> **"صحيحة هي الطريقة لقول أنك قصدتها"**
>
> تحديث وحذف بدون مرشح سيمس كل مستند، لذا يتوقفون إلا إذا أضفتم كل: صحيح. القراء ليس لديهم مثل هذا الحارس - مرشح فارغ عند العثور هو سؤال عادي.

## تم حفظ الصلة {#pooling}

واحد لكل عميل URI يتم حجزها وإعادة استخدامها عبر المكالمات، لذلك فإن الثاني `run()` لا إعادة اتصال. A URI ( ١ تيموثاوس ٣ : ١ ) فَهَلْ تَتَغَيَّرُ ٱلْمَسِيحِيُّونَ ؟

## تم ترشيح النظام خارج {#system}

`collections` and `overview` leave out anything in the `system.` namespace. What you see is what you put there.

- [connect()](/ar/sdk/ref/storage/connect): النداء نفسه، و أين يذهب السر.
- [run()](/ar/sdk/ref/connected-storage/run): كل عمل، وما يأخذه كل واحد
- [IaGenify سحاب](/ar/sdk/ref/providers/iagenify-cloud): نفس الشكل، بدون أيّ وثائق اعتماد للتموين.

```python
db = api.storage.connect(
    label="Production",
    type="database",
    provider="mongodb",
    endpoint={"credentials": {"uri": "mongodb+srv://user:password@cluster.example.net/shop"}},
)
```

```python
order = db.run(action="find", collection="orders", options={"limit": 1})[0]

# order["_id"] arrived as a string; it goes back as one
db.run(
    action="update",
    collection="orders",
    filter={"_id": order["_id"]},
    update={"$set": {"status": "shipped"}},
)
```

```python
db.run(action="find", collection="users", filter={"$where": "this.age > 30"})
# IaGenifyError: find : l'operateur $where n'est pas autorise.
```
