-
Hello, I have the kind of document:
and I want to make queries on this collection. So I created this file: 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:
and if I remove the Is the type |
Beta Was this translation helpful? Give feedback.
Answered by
tillwf
Dec 24, 2023
Replies: 1 comment
-
The problem seems to come from the encoding itself: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tillwf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem seems to come from the encoding itself:
https://stackoverflow.com/questions/77680833/load-mongo-binary-createfrombase64-field-in-python