Originally posted by **tillwf** December 8, 2023
Hello,
I have the kind of document:
```bson
{
_id: ObjectId('656f001650078dc1d50872ed'),
created_at: ISODate('2023-12-05T10:48:54.641Z'),
user_id: Binary.createFromBase64('MjkyMmZkYmUtOTM1Yi0xMWVlLTlkMjEtN2U2NjQwYmEyNGEw', 4),
}
```
and I want to make queries on this collection. So I created this file:
```python
import base64
import uuid
from datetime import datetime
from typing import Optional
from beanie import Document, init_beanie
from beanie import BsonBinary
from pydantic import BaseModel, Field
from bson import Binary, ObjectId
from pymongo import MongoClient
# HomeTracker document class
class HomeTrackers(Document):
id: ObjectId = Field(default_factory=ObjectId, alias="_id")
created_at: datetime
user_id: BsonBinary
class Settings:
name = "collection_name"
class Config:
arbitrary_types_allowed = True
```
but when I make a query I get this error:
```
bson.errors.InvalidBSON: invalid length or type code
```
and if I remove the `user_id` field, everything works.
Is the type `Binary.createFromBase64(..., 4)` supported by beanie?
Discussed in https://github.com/roman-right/beanie/discussions/800