MongoDB migration does not work.
surister opened this issue · 4 comments
Running a migr8 command with a simple document {"text": "hola"}
migr8 export --url "mongodb://root:example@192.168.88.251:27017" --database test_db --collection test_col
Gives:
(.venv) ~/PycharmProjects/crate/cratedb-toolkit git:[main]
migr8 export --url "mongodb://root:example@192.168.88.251: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'
I already have a fix, will pr later (found other issues)
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?
This no longer happens in master, when I came across this;
document
was a dict
, now it's correctly a bson
document and doesn't fail.
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.