# oid_to_str

> **Function** in `langchain_mongodb`

📖 [View in docs](https://reference.langchain.com/python/langchain-mongodb/utils/oid_to_str)

Convert MongoDB's internal BSON ObjectId into a simple str for compatibility.

Instructive helper to show where data is coming out of MongoDB.

## Signature

```python
oid_to_str(
    oid: Any,
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `oid` | `Any` | Yes | bson.ObjectId |

## Returns

`str`

24 character hex string.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-mongodb/blob/082c8767db049e381691f53c9718e5ebfe4e6f0f/libs/langchain-mongodb/langchain_mongodb/utils.py#L167)