Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB migration does not work. #204

Closed
surister opened this issue Jul 22, 2024 · 4 comments
Closed

MongoDB migration does not work. #204

surister opened this issue Jul 22, 2024 · 4 comments
Assignees
Labels
bug Something isn't working python Pull requests that update Python code

Comments

@surister
Copy link
Contributor

Running a migr8 command with a simple document {"text": "hola"}
migr8 export --url "mongodb://root:[email protected]:27017" --database test_db --collection test_col

Gives:

(.venv) ~/PycharmProjects/crate/cratedb-toolkit git:[main]
migr8 export --url "mongodb://root:[email protected]:27017" --database test_db --collection test_col
Traceback (most recent call last):
  File "/home/surister/PycharmProjects/crate/cratedb-toolkit/.venv/bin/migr8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/surister/PycharmProjects/crate/cratedb-toolkit/cratedb_toolkit/io/mongodb/cli.py", line 92, in main
    export_to_stdout(args)
  File "/home/surister/PycharmProjects/crate/cratedb-toolkit/cratedb_toolkit/io/mongodb/cli.py", line 81, in export_to_stdout
    export(args)
  File "/home/surister/PycharmProjects/crate/cratedb-toolkit/cratedb_toolkit/io/mongodb/core.py", line 119, in export
    collection_to_json(db[args.collection], file=buffer)
  File "/home/surister/PycharmProjects/crate/cratedb-toolkit/cratedb_toolkit/io/mongodb/export.py", line 107, in collection_to_json
    bson_json = bsonjs.dumps(document.raw)
                             ^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'raw'
@surister
Copy link
Contributor Author

I already have a fix, will pr later (found other issues)

@surister surister added bug Something isn't working python Pull requests that update Python code labels Jul 22, 2024
@surister surister self-assigned this Jul 22, 2024
@amotl
Copy link
Member

amotl commented Jul 23, 2024

I already have a fix, will pr later (found other issues)

Thank you so much! If you are at it, can you also have a look at that other error report?

@surister
Copy link
Contributor Author

surister commented Aug 2, 2024

This no longer happens in master, when I came across this;

for document in collection.find():

document was a dict, now it's correctly a bson document and doesn't fail.

@surister surister closed this as completed Aug 2, 2024
@amotl
Copy link
Member

amotl commented Aug 2, 2024

Excellent, thank you! So, the package needs a release to make it work? I can't remember anything has been changed in mongodb/export recently, but if you are effectively saying that the most recent release package does not work, a new release would be needed indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

2 participants