Skip to content

Address uniqueness, ordering, properties#151

Open
hhaensel wants to merge 2 commits into
JuliaDatabases:masterfrom
hhaensel:hh-uniqueness-ordering
Open

Address uniqueness, ordering, properties#151
hhaensel wants to merge 2 commits into
JuliaDatabases:masterfrom
hhaensel:hh-uniqueness-ordering

Conversation

@hhaensel

Copy link
Copy Markdown

This PR relates to #150 and to #146

@hhaensel hhaensel changed the title Address uniqueness, ordering, property Address uniqueness, ordering, properties Apr 24, 2026
@ancapdev

Copy link
Copy Markdown
Collaborator

I don't have well thought out opinions about most of what's added here, but the global dict type override looks risky to me.

It can change the behaviour of a program in areas far removed from where it's set, which is only safe if you own and control all the code you're running, and even then it's hairy when things scale.

What's the motivation for having that a global setting, rather than passing in the dict type where you need it to be specific non-standard type?

@hhaensel

Copy link
Copy Markdown
Author

I didn't want the PR to be breaking but I also wanted to offer a short syntax for returning OrderedDicts.
But I agree to your objection.

If you accept a breaking PR, my preferred solution would be to default to OrderedDict in all cases.
If you don't want a breaking change then document["key"] could return Dict while document[:key] and document.key would return OrderedDict.

@hhaensel

Copy link
Copy Markdown
Author

Another question is whether we accept that document["key"] doesn't retrieve the last index. Otherwise we could fix that as well.
We could discuss whether for performance reason we always iterate twice or whether we always parse the first value and reparse the last if there is more than one entry. Unortunately there is no easy way to save an iterator's value without parsing. I tried bson_iter_value() and bson_copy_to(), but my trials failed.

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

Successfully merging this pull request may close these issues.

2 participants