Anna-Team / AnnaDB

Developer-first database
Apache License 2.0
56 stars 4 forks source link

Documentation: Document example and purpose of update, `inc` #10

Open amaster507 opened 1 year ago

amaster507 commented 1 year ago

I am assuming that inc increments a number. Is this correct? I am about to try it out.

amaster507 commented 1 year ago

image

And not successful in figuring it out. I thought in the first update, I would update the core by 2, and in the second try, I thought maybe it just increments one at a time. But neither works

roman-right commented 1 year ago

Yes, it increments the number by provided value. Here is an example:

            collection|test|:q[
                find[
                    eq{value|is_even|:b|true|}
                ],
                update[
                    inc{value|num|:n|100|}
                ]
            ];
roman-right commented 1 year ago

I think the problem is the brackets (. inc works with {

roman-right commented 1 year ago

But I have to work on the error handling. It is not obvious at all :)

amaster507 commented 1 year ago

Got it.

Maybe should update the documentation to show {...} instead of (...)

image

roman-right commented 1 year ago

Yes! This is a typo. Thank you

amaster507 commented 1 year ago

I see you corrected the docs here. I am going to leave this open until we get an example of the inc operation in the docs and maybe a little more than just set(...) like possibly set(<root|path>,<number>) but then it would be good somewhere to define the syntax of <root|path> and <number> and then all of that could be hyperlinked in the docs