Hacker News new | past | comments | ask | show | jobs | submit login

FaunaDB appears to have some kind of transaction support[1], so atomic updates of the sort you mention seem feasible. That said, I'm a huge SQL partisan, and I'd much rather talk to a SQL database than this custom thing.

https://docs.fauna.com/fauna/current/concepts/isolation_leve...




I did find an example of an atomic increment in Faunadb. Sometimes SQL is easier :) :

  Update(
    Ref(
        Collection('topics'),
        '254119747652682260'
    ),
    { 
        data: { 
            clickCount: Add(
                Select(
                    ['data','clickCount'],
                    Get(
                        Ref(
                            Collection('topics'),
                            '254119747652682260'
                        )
                    )
                ),
                1
            )
        }
    }
  )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: