Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

AtomicUpdate does not accept Case Class #44

Description

@mefellows

This is more of a question than anything.

Given that save is now deprecated and has been moved to AtomicUpdate.atomicUpsert etc., is there a way to update an existing Entity without marshalling to a BSONDocument manually? It would seem to me that without this feature the whole CASE CLASS <-> JSON <-> BSON conversion value proposition breaks down a bit.

i.e. Rather than (from AtomicUpdateSpec.scala):

    repositoryWithIdOverride.atomicUpsert(findByField(testObj.name),
      BSONDocument(
        "$setOnInsert" -> BSONDocument("_id" -> testObj.id),
        "$set" -> BSONDocument("name" -> testObj.name),
        "$set" -> BSONDocument("someOtherField" -> testObj.someOtherField)
      ), idAttribute)

something like would be more idiomatic for this project:

val myObject = MyObject(id, "foo")
repositoryWithIdOverride.atomicUpsert(myObject)

Or is this just wishful thinking on my part?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions