From: Tim Nelson <tnell...@gmail.com>
Date: Mon, 15 Oct 2012 12:47:29 -0700 (PDT)
Local: Mon, Oct 15 2012 3:47 pm
Subject: Re: [Lift] Re: Updating an embedded document (MongoJsonObjectField)
If you have the following: case class TypeTestJsonObject( } object TypeTestJsonObject extends JsonObjectMeta[TypeTestJsonObject] class ListTestRecord private () extends MongoRecord[ListTestRecord] with object mandatoryMongoJsonObjectListField extends } object ListTestRecord extends ListTestRecord with MongoMetaRecord[ListTestRecord] To add an item to the field: import net.liftweb.json._ val rec = ListTestRecord.find(...) val qry: JValue = ("_id" -> ....) rec.update(qry, upd) To remove an item: val upd: JValue = ("$pull" -> ("mandatoryMongoJsonObjectListField" -> rec.update(qry, upd) I've been thinking of adding these functions to the ListFields but haven't Rogue has a much better way of doing this, btw. If you haven't looked into Tim On Monday, October 15, 2012 9:34:34 AM UTC-5, maarten wrote:
> Hi Tim, > I have trouble seeing how that works (nor could I find an example) > Thanks, > Maarten > On Mon, Oct 15, 2012 at 3:06 PM, Tim Nelson <tnel...@gmail.com<javascript:>> > > If all you're updating is the one column, I would say use an update > > Tim > > On Monday, October 15, 2012 4:46:03 AM UTC-5, maarten wrote: > >> Hi, > >> Subjects says it hopefully all: what is the most elegant way to update > >> I only found solutions that force you to build new lists on the client > >> Any feedback appreciated - and I'll add it to the Wiki as soon as I > >> Thanks! > >> --Maarten > > -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||