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

AtomicUpdate does not accept Case Class #44

Open
mefellows opened this issue Oct 14, 2015 · 0 comments
Open

AtomicUpdate does not accept Case Class #44

mefellows opened this issue Oct 14, 2015 · 0 comments

Comments

@mefellows
Copy link
Contributor

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant