mongo-schema-export icon indicating copy to clipboard operation
mongo-schema-export copied to clipboard

float in key value

Open tvernick opened this issue 6 years ago • 8 comments

Hi there- Any idea why I would be getting a float value from the key when exporting? The value is just "phone" : 1 in mongo. For example: { "name": "phone_1", "background": true, "keys": [ [ "phone", 1.0 ] ] } ], "options": {}

tvernick avatar Nov 27 '18 21:11 tvernick

What version of python are you running?

Regardless, I'll push a fix to ensure all keys are exported as int

JonnoFTW avatar Nov 28 '18 01:11 JonnoFTW

python 3.6 Appreciate that thanks!

On Tue, Nov 27, 2018, 8:04 PM Jonathan Mackenzie <[email protected] wrote:

What version of python are you running?

Regardless, I'll push a fix to ensure all keys are exported as int

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JonnoFTW/mongo-schema-export/issues/1#issuecomment-442278806, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMBvm8928roNvh2PaNtlTmjniBmha3-ks5uzeE3gaJpZM4Y2Xw7 .

tvernick avatar Nov 28 '18 01:11 tvernick

What versions of pymongo and mongodb?

JonnoFTW avatar Nov 28 '18 01:11 JonnoFTW

Whatever is most recent python 3 pymongo and mongo 3.6.6

On Tue, Nov 27, 2018, 8:34 PM Jonathan Mackenzie <[email protected] wrote:

What versions of pymongo and mongodb?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JonnoFTW/mongo-schema-export/issues/1#issuecomment-442284667, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMBvpTvc6zE31GhTAd7lumzcje6ZLMMks5uzegmgaJpZM4Y2Xw7 .

tvernick avatar Nov 28 '18 01:11 tvernick

@tvernick Please test the fix by running pip install -U mongo-schema-export

It should place the scripts in your bin directory of your python install, so you should now be able to run

mongo-schema-export.py ...

JonnoFTW avatar Nov 28 '18 01:11 JonnoFTW

Works great, thanks!

On Tue, Nov 27, 2018 at 8:56 PM Jonathan Mackenzie [email protected] wrote:

@tvernick https://github.com/tvernick Please test the fix by running pip install -U mongo-schema-export

It should place the scripts in your bin directory of your python install, so you should now be able to run

mongo-schema-export.py ...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JonnoFTW/mongo-schema-export/issues/1#issuecomment-442289033, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMBvhre2EhaJwd5lpJrMEMiQBzBL5t0ks5uze1egaJpZM4Y2Xw7 .

tvernick avatar Nov 28 '18 18:11 tvernick

I see to be getting another error from that change now

Traceback (most recent call last): File "export_mongo.py", line 88, in sys.exit(main() or 0) File "export_mongo.py", line 82, in main s = mongo_export(_client, args.file, args.databases, args.verbose) File "export_mongo.py", line 38, in mongo_export i['keys'] = [[k, int(v)] for k, v in i['key'].items()] File "export_mongo.py", line 38, in i['keys'] = [[k, int(v)] for k, v in i['key'].items()] ValueError: invalid literal for int() with base 10: 'hashed'

Looks like this won't work if the sort is called "hashed".

On Wed, Nov 28, 2018 at 1:38 PM Todd Vernick [email protected] wrote:

Works great, thanks!

On Tue, Nov 27, 2018 at 8:56 PM Jonathan Mackenzie < [email protected]> wrote:

@tvernick https://github.com/tvernick Please test the fix by running pip install -U mongo-schema-export

It should place the scripts in your bin directory of your python install, so you should now be able to run

mongo-schema-export.py ...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JonnoFTW/mongo-schema-export/issues/1#issuecomment-442289033, or mute the thread https://github.com/notifications/unsubscribe-auth/ADMBvhre2EhaJwd5lpJrMEMiQBzBL5t0ks5uze1egaJpZM4Y2Xw7 .

tvernick avatar Nov 28 '18 19:11 tvernick

@tvernick I've pushed a fix. Please try it and report back results

JonnoFTW avatar Dec 03 '18 03:12 JonnoFTW