Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Filter with int default (0) value. #34

Closed
p1eXu5 opened this issue Nov 27, 2022 · 3 comments
Closed

Filter with int default (0) value. #34

p1eXu5 opened this issue Nov 27, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@p1eXu5
Copy link

p1eXu5 commented Nov 27, 2022

With options.DefaultIgnoreCondition <- JsonIgnoreCondition.WhenWritingDefault settings expression like this:

find "users" {
    filter {| age = {| ``$gt`` = 0 |} |}
    limit 5
}

is producing this json:

{"find":"users","filter":{"age":{}},"limit":{"$numberInt":"5"}}

and we get no documents.

But with options.DefaultIgnoreCondition <- JsonIgnoreCondition.WhenWritingNull:

{"find":"users","filter":{"age":{"$gt":{"$numberInt":"0"}}},"limit":{"$numberInt":"5"}}

and filter works as expected.

I suppose you should replace the settings in default serializer options.

Affected version: Mondocs.Net (0.4.8)

@AngelMunoz
Copy link
Owner

Hey there thanks for the notice!
I agree, we should get this one changed

@AngelMunoz AngelMunoz added the bug Something isn't working label Nov 28, 2022
@AngelMunoz
Copy link
Owner

There was an issue related to this when you wanted to actually use null values in queries I think I made the change to default value due to this #32

But I think going back to when writing null is a good call out

I might need to re-visit this library later because this serialization stuff is quite flakey

@AngelMunoz
Copy link
Owner

v0.5.0 is out and we went back to when writing null, please give it a shot and let me know if something is not so right

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants