Status/Resolution/Reason: To Fix//MustFix
Reporter/Name(from Bugbase): Christopher Karras / ()
Created: 10/09/2018
Components: Language
Versions: 2016
Failure Type: Others
Found In Build/Fixed In Build: Adobe Coldfusion 2016 and 2018 /
Priority/Frequency: Normal /
Locale/System: / Windows 10 64 bit
Vote Count: 19
Problem Description:
When using QueryFilter the original query is mutated
Steps to Reproduce:
{code:java}
<cfscript>
 	news = queryNew("id,type,title", "integer,varchar,varchar");
 	queryAddRow(news,[
 	{ id: 1, type: "book", title: "Cloud Atlas" }
 	,
 	
 	{ id: 2, type: "book", title: "Lord of The Rings" }
 	,
 	
 	{ id: 3, type: "film", title: "Men in Black" }
 	]);
 	
 	books = news.filter(function(_news)
 	
 	{ return _news.type == 'book'; }
 	);
 	writeDump(ValueList(books.title,', '));
 	writeDump(books)
 	writeDump(news)
 </cfscript>
{code}
Actual Result:
Books:
query
 	id	title	type
1	1	Cloud Atlas	book
2	2	Lord of The Rings	book
News:
query
 	id	title	type
1	1	Cloud Atlas	book
2	2	Lord of The Rings	book
Expected Result:
Books:
query
 	ID	TITLE	TYPE
1	1	Cloud Atlas	book
2	2	Lord of The Rings	book
News:
query
 	id	title	type
1	1	Cloud Atlas	book
2	2	Lord of The Rings	book
3	3	Men in Black	film
Any Workarounds:
Instead of `books = news.filter()` you can use `books = duplicate(news).filter()`Attachments:
Comments: