Update last element of a nested array in mongodb

I have tried the below query of mongoose which does not seem to work:

Model.findOneAndUpdate(
	{
		name: origin
	},
	{
		$set: {
			'field1.$[id1].field2.-1': "value"
		}
	},
	{
		arrayFilters: [
			{ 'id1.userId': "customerId" }
		],
		new: true
	}
);

Note: field1 and field2 are arrays

The negative indexes are not accepted by MongoDB which is causing problems.