top of page

What You Need to Know About Advanced CSV Converter Patch

  • Writer: lacontmucomsamatof
    lacontmucomsamatof
  • Aug 14, 2023
  • 5 min read


The advanced features of git log can be split into two categories: formatting how each commit is displayed, and filtering which commits are included in the output. Together, these two skills give you the power to go back into your project and find any information that you could possibly need.


Formatting how each commit gets displayed is only half the battle of learning git log. The other half is understanding how to navigate the commit history. The rest of this article introduces some of the advanced ways to pick out specific commits in your project history using git log. All of these can be combined with any of the formatting options discussed above.




Advanced CSV Converter patch



Typed Session APIA type-safe session interface that allows performing the most common patch operations.The patch request will be sent to the server only after the call to SaveChanges. This way it's possible to perform multiple operations in one request to the server.


Non-Typed Session APIThe non-typed Session API for patches uses the Session.Advanced.Defer function which allows registering one or more commands.One of the possible commands is the PatchCommandData, describing single document patch command.The patch request will be sent to the server only after the call to SaveChanges, this way it's possible to perform multiple operations in one request to the server.


ExamplesChange Field's ValueSession-typed-syntaxSession-syntax-untypedOperations-syntax// change FirstName to Robert session.Advanced.Patch( "employees/1", x => x.FirstName, "Robert");session.SaveChanges();// change FirstName to Robert session.Advanced.Defer(new PatchCommandData( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @"this.FirstName = args.FirstName;", Values = "FirstName", "Robert" , patchIfMissing: null));session.SaveChanges();// change FirstName to Robert store.Operations.Send(new PatchOperation( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @"this.FirstName = args.FirstName;", Values = "FirstName", "Robert" , patchIfMissing: null));Change Values of Two FieldsSession-typed-syntaxSession-syntax-untypedOperations-syntax// change FirstName to Robert and LastName to Carter in single request// note that in this case, we create single request, but two seperate batch operations// in order to achieve atomicity, please use the non generic APIssession.Advanced.Patch("employees/1", x => x.FirstName, "Robert");session.Advanced.Patch("employees/1", x => x.LastName, "Carter");session.SaveChanges();// change FirstName to Robert and LastName to Carter in single request// note that here we do maintain the atomicity of the operationsession.Advanced.Defer(new PatchCommandData( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @" this.FirstName = args.UserName.FirstName this.LastName = args.UserName.LastName", Values = "UserName", new FirstName = "Robert", LastName = "Carter" , patchIfMissing: null));session.SaveChanges();// change FirstName to Robert and LastName to Carter in single request// note that here we do maintain the atomicity of the operationstore.Operations.Send(new PatchOperation( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @" this.FirstName = args.UserName.FirstName this.LastName = args.UserName.LastName", Values = "UserName", new FirstName = "Robert", LastName = "Carter" , patchIfMissing: null));Increment ValueSession-typed-syntaxSession-syntax-untypedOperations-syntax// increment UnitsInStock property value by 10session.Advanced.Increment("products/1-A", x => x.UnitsInStock, 10);session.SaveChanges();session.Advanced.Defer(new PatchCommandData( id: "products/1-A", changeVector: null, patch: new PatchRequest Script = @"this.UnitsInStock += args.UnitsToAdd", Values = "UnitsToAdd", 10 , patchIfMissing: null));session.SaveChanges();store.Operations.Send(new PatchOperation( id: "products/1-A", changeVector: null, patch: new PatchRequest Script = @"this.UnitsInStock += args.UnitsToAdd", Values = "UnitsToAdd", 10 , patchIfMissing: null));Add or IncrementAddOrIncrement increments an existing field or adds a new one in documents where they didn't exist.


// While running AddOrPatch specify session.Advanced.AddOrPatch(// Specify document id and entity on which the operation should be performed. id, new User FirstName = "John", LastName = "Doe", LastLogin = DateTime.Now , // The path to the field and value to set. x => x.LastLogin, new DateTime(2021, 9, 12));session.SaveChanges();Add or Patch to an Existing ArrayThis sample shows how to patch an existing array or add it to documents where it doesn't yet exist.


// While running AddOrPatch specify session.Advanced.AddOrPatch( // Specify document id and entity on which the operation should be performed. id, new User FirstName = "John", LastName = "Doe", LoginTimes = new List DateTime.UtcNow , // The path to the field x => x.LoginTimes, // Modifies the array u => u.Add(new DateTime(1993, 09, 12), new DateTime(2000, 01, 01)));session.SaveChanges();Add Item to ArraySession-typed-syntaxSession-syntax-untypedOperations-syntax// add a new comment to Commentssession.Advanced.Patch("blogposts/1", x => x.Comments, comments => comments.Add(new BlogComment Content = "Lore ipsum", Title = "Some title" ));session.SaveChanges();// add a new comment to Commentssession.Advanced.Defer(new PatchCommandData( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = "this.Comments.push(args.Comment)", Values = "Comment", new BlogComment Content = "Lore ipsum", Title = "Some title" , patchIfMissing: null));session.SaveChanges();// add a new comment to Commentsstore.Operations.Send(new PatchOperation( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = "this.Comments.push(args.Comment)", Values = "Comment", new BlogComment Content = "Lore ipsum", Title = "Some title" , patchIfMissing: null));Insert Item into Specific Position in ArrayInserting item into specific position is supported only by the non-typed APIsSession-syntax-untypedOperations-syntax// insert a new comment at position 1 to Commentssession.Advanced.Defer(new PatchCommandData( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = "this.Comments.splice(1,0,args.Comment)", Values = "Comment", new BlogComment Content = "Lore ipsum", Title = "Some title" , patchIfMissing: null));session.SaveChanges();store.Operations.Send(new PatchOperation( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = "this.Comments.splice(1,0,args.Comment)", Values = "Comment", new BlogComment Content = "Lore ipsum", Title = "Some title" , patchIfMissing: null));Modify Item in Specific Position in ArrayInserting item into specific position is supported only by the non-typed APIsSession-syntax-untypedOperations-syntax// modify a comment at position 3 in Commentssession.Advanced.Defer(new PatchCommandData( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = "this.Comments.splice(3,1,args.Comment)", Values = "Comment", new BlogComment Content = "Lore ipsum", Title = "Some title" , patchIfMissing: null));session.SaveChanges();// modify a comment at position 3 in Commentsstore.Operations.Send(new PatchOperation( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = "this.Comments.splice(1,0,args.Comment)", Values = "Comment", new BlogComment Content = "Lore ipsum", Title = "Some title" , patchIfMissing: null));Filter out Items from an ArraySession-typed-syntaxSession-syntax-untypedOperations-syntax// filter out all comments of a blogpost which contains the word "wrong" in their contents session.Advanced.Patch("blogposts/1", x => x.Comments, comments => comments.RemoveAll(y => y.Content.Contains("wrong")));session.SaveChanges();// filter out all comments of a blogpost which contains the word "wrong" in their contents session.Advanced.Defer(new PatchCommandData( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = @"this.Comments = this.Comments.filter(comment=> comment.Content.includes(args.TitleToRemove));", Values = "TitleToRemove", "wrong" , patchIfMissing: null));session.SaveChanges();// filter out all comments of a blogpost which contains the word "wrong" in their contentsstore.Operations.Send(new PatchOperation( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = @"this.Comments = this.Comments.filter(comment=> comment.Content.includes(args.TitleToRemove));", Values = "TitleToRemove", "wrong" , patchIfMissing: null));Loading Documents in a ScriptLoading documents supported only by non-typed APIsSession-syntax-untypedOperations-syntax// update product names in order, according to loaded product documentssession.Advanced.Defer(new PatchCommandData( id: "orders/1", changeVector: null, patch: new PatchRequest Script = @"this.Lines.forEach(line=> var productDoc = load(line.Product); line.ProductName = productDoc.Name; );" , patchIfMissing: null));session.SaveChanges();// update product names in order, according to loaded product documentsstore.Operations.Send(new PatchOperation( id: "blogposts/1", changeVector: null, patch: new PatchRequest Script = @"this.Lines.forEach(line=> var productDoc = load(line.Product); line.ProductName = productDoc.Name; );" , patchIfMissing: null));Remove PropertyRemoving property supported only by the non-typed APIsSession-syntax-untypedOperations-syntax// remove property Agesession.Advanced.Defer(new PatchCommandData( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @"delete this.Age" , patchIfMissing: null));session.SaveChanges();// remove property Agestore.Operations.Send(new PatchOperation( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @"delete this.Age" , patchIfMissing: null));Rename PropertyRenaming property supported only by the non-typed APIsSession-syntax-untypedOperations-syntax// rename FirstName to Firstsession.Advanced.Defer(new PatchCommandData( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @" var firstName = this[args.Rename.Old]; delete this[args.Rename.Old]; this[args.Rename.New] = firstName", Values = "Rename", new Old = "FirstName", New = "Name" , patchIfMissing: null));session.SaveChanges();store.Operations.Send(new PatchOperation( id: "employees/1", changeVector: null, patch: new PatchRequest Script = @" var firstName = this[args.Rename.Old]; delete this[args.Rename.Old]; this[args.Rename.New] = firstName", Values = "Rename", new Old = "FirstName", New = "Name" , patchIfMissing: null));Add DocumentAdding a new document is supported only by the non-typed APIsSession-syntax-untypedOperations-syntaxsession.Advanced.Defer(new PatchCommandData("employees/1-A", null, new PatchRequest Script = "put('orders/', Employee: id(this) );", , null));session.SaveChanges();store.Operations.Send(new PatchOperation("employees/1-A", null, new PatchRequest Script = "put('orders/', Employee: id(this) );",));Clone DocumentIn order to clone a document use put method as followsSession-syntax-untypedOperations-syntaxsession.Advanced.Defer(new PatchCommandData("employees/1-A", null, new PatchRequest Script = "put('employees/', this);", , null));session.SaveChanges();store.Operations.Send(new PatchOperation("employees/1-A", null, new PatchRequest Script = "put('employees/', this);",));Cloning, Attachments & CountersThe attachments and/or counters from the source document will not be copied to the new one automatically.


2ff7e9595c


 
 
 

Recent Posts

See All

Comments


M:  info@mysite.com

T:   123-456-7890

F:   123-456-7890

A:   500 Terry Francois St.
San Francisco, CA 94158

C R A F T - H O U S E

Success! Message received.

© 2023 by Craft House. Proudly created with Wix.com

bottom of page