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

Question about BSON. #7

Open
wclr opened this issue Dec 29, 2024 · 2 comments
Open

Question about BSON. #7

wclr opened this issue Dec 29, 2024 · 2 comments

Comments

@wclr
Copy link

wclr commented Dec 29, 2024

Mongodb uses BSON for storing and representation of the data. https://www.mongodb.com/resources/basics/json-and-bson

For the end user BSON is like JSON but with additional types, if we were to create a library for working with directlry with BSON, should it mostly mimic this library extending it with suppored BSON types? (And then implement similar codecs library).

@garyb interesting to hear your thoughts on this.

@garyb
Copy link
Member

garyb commented Dec 30, 2024

I'm not sure, this library was driven by the fact we can use the FFI to manipulate a representation of JSON without the need to convert it into PureScript values directly. I don't know if there's a way to do with that with BSON, but I suspect not - JSON is kinda privileged since it's synonymous with JS literals to a large degree.

You could work with the EJSON representation perhaps. You could build that on top of this without having to redefine everything from scratch then, or probably just skip introducing an abstraction for it at all, and just deal with it in the codec layer.

@wclr
Copy link
Author

wclr commented Dec 30, 2024

You could work with the EJSON representation perhaps. You could build that on top of this without having to redefine everything from scratch then, or probably just skip introducing an abstraction for it at all, and just deal with it in the codec layer.

Right, I was thinking about using EJSON as the intermediate format. The thing that pushed me away is that when using mongodb nodejs driver it requires serialization/deserialization steps from/to JS Objects (BSON.Document) that the driver works with. Though maybe, considering that purescript's encoding/decoding layer approach already assumes overheads this is not drastical to be worried about even in the general case?

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