chokes with FastAPI / Pymongo when I add "from bson import objectId"

I am using FastAPI and PyMongo. Everything works great until I try to add a PUT command. This necessitates (AFAIK - I am following some youtube examples) adding in from bson import objectId.
However, when I do this I get:
ImportError: cannot import name '_get_object_size' from 'bson'
After this, the project is hosed. It never works again.

Hello @SamuelLinton and welcome to the community!

Could you please share the link to your repl?

1 Like

I seem to have fixed the problem.
I used from bson import ObjectId (note the change in capitalization), and it works. However, I did have to start with a new project because I could never get the old one working.

i dont know how to use codes

1 Like

Welcome to Ask @4013113!
You can learn Java & Kotlin here, and you can learn Python here. I would also recommend W3Schools.