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

mc/find-one-as-map can return malformed sub-maps with "/" character in the key. #191

Open
datafatmunger opened this issue Dec 21, 2019 · 1 comment

Comments

@datafatmunger
Copy link

Insert the following document:
{"content" : { "prjfoobar/files/foo" : "foo" }

(mc/find-one-as-map db "documents" { :_id (ObjectId. "5dfe449f1bbe8f22701dcf27") })

Returns:
{:_id #object[org.bson.types.ObjectId 0x93cf96d "5dfe449f1bbe8f22701dcf27"], :content #:prjfoobar{:files/foo "foo"}}

... the content map is pretty broken.

Version: 3.1.0

@mjrb
Copy link
Contributor

mjrb commented Sep 4, 2021

This seems to be just some strangeness with the clojure pretty printer if you do {(keyword "projfoobar/files/foo") "foo"} it returns #:projfoobar{:files/foo "foo"} which seems to be some kind of namespaced map (since having / in keywords allows you to namespace them) if you do (:projfoobar/files/foo {(keyword "projfoobar/files/foo") "foo"}) it returns "foo" and if you do (keys {(keyword "projfoobar/files/foo") "foo"}) it returns (:projfoobar/files/foo).

so it seems like everything works fine just the pretty printing is trying to be smart. if you want to print it more normally you can pass in false for keywordize http://reference.clojuremongodb.info/monger.collection.html#var-find-one-as-map and it wont turn the keys into keywords

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants