Migrating patching from 3.5 -> 4.0

31 views
Skip to first unread message

Anders Granberg

unread,
Feb 21, 2018, 6:02:46 AM2/21/18
to RavenDB - 2nd generation document database

I'm currently migrating my project from 3.5 to 4.0. I'm doing a lot of patching and I have encountered some problems when trying to translate my patches to 4.0.

I understand that lodash is no longer available. I’ve also noticed that some of the earlier helpers does not work. The problem is that I can’t find any documentation of breaking changes regarding patching. 

Will appreciate any help regarding any of these questions:

1) Are there any documentation on how to migrate patches from 3.5 -> 4.0 that I’m missing?
2) I’ve come across a couple of new syntax like “filter”. Can I use ES6 syntax to the full extent? Or is only a few functions implemented (and if so, which ones?)?
3) Would also be grateful if someone can help me find the equivalents of the following 3.5 patches:

var item = _.find(myArray, function(item) {{
 
return item.Id == args.Id;
}});

_.forEach(myArray, function(item) {{
 item
.Name = args.Name;
 item
.City = args.City;
 item
.Mascot = args.Mascot;
}});


this
.MyArray.RemoveWhere(function(item) {{
    
return item.Id == args.Id;
}});


var myArray = this.AllItems.Where(function(item) {{
 
return item.Id == args.Id;
}});



Oren Eini (Ayende Rahien)

unread,
Feb 21, 2018, 6:16:13 AM2/21/18
to ravendb
1) We now support ES5 (some ES6 syntax, such as arrow functions) syntax. The idea is that you can write standard JS without needing anything further.
2) These are actually standard js methods, so they should all be there.  It terms of methods, they should all be there.
3) 

var item = myArray.filter( a=>a.Id == args.Id)[0];

for(var i = 0; i < myArray.length; i++)
{
   var item = myArray[i];
 item.Name = args.Name;
 item
.City = args.City;
 item
.Mascot = args.Mascot;
}


this.MyArray = this.MyArray.filter(i => i.Id != args.Id);


var myArray = this.MyArray.filter(i => i.Id == args.Id);




Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anders Granberg

unread,
Feb 21, 2018, 4:39:22 PM2/21/18
to RavenDB - 2nd generation document database
Thanks for clearing that up!
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages