Code Monkey home page Code Monkey logo

Comments (3)

jackrusher avatar jackrusher commented on September 7, 2024 1

Thank you for your speedy reply. It turns out to be somewhat painful to encode/decode a structure like:

{:_id 1 :content "blob of XML" :terms { "unigram" 1 "bi gram " 2 "a tri gram" 3 }}

... because 'keywordize' wants to convert all or none. I've fallen back to converting the string keys into composite keywords, a la { :bi_gram 2 }, which is fine for my use case.

That said, I do regard it as a bug that the default behavior of the library will silently change the layout of a hash-map of primitive structures on load/save. Looking at the code, it's not an easy thing to fix (you'd have to annotate the hash-map with metadata to know which keys should be keywordized, which is probably not worth it for such an uncommon case), but it might be wise to document this behavior prominently.

Thanks again!

from monger.

michaelklishin avatar michaelklishin commented on September 7, 2024

For functions where it matters there are extra parameters or options that control this behavior. The name is usually keywordize.

from monger.

michaelklishin avatar michaelklishin commented on September 7, 2024

Another option is to use monger.collection/find instead of monger.collection/find-maps and then use monger.conversion functions however you like, with keywordize set to true or not.

from monger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.