Hi.
I wrote a projection then i deleted it. When i try to create another projection with the same name, the new projection has been created but the status stays to “Prepared/Initial”, i can’t use it, and i’ve got a log error :
[PID:00772:013 2014.05.14 12:17:54.044 ERROR QueuedHandlerMRES ] Error while processing message WRITE COMPLETED: CorrelationId: 948907eb-8e57-4bcd-b4ff-351d70b00ef1, Result: Success, Message: , FirstEventNumber: 2 in queued handler ‘Projections Master’.
System.Exception: Projection version and event number mismatch
If you’re using version 2 of the Event Store then this is a side effect of not being able to reuse stream names (projections are internally stored as streams). If you use version 3 RC then you can do this.
fromStream(‘Reservations’)
.when({
$init: function () {
return { body : ‘’, }; // initial state
},
ReservationEvent: function(s, e) {
if(e.data.NewReservation !==null)
{
if(e.data.NewReservation.User.Ent.Id == ‘20f3bac6-aa91-4a83-84a1-7f0fe2304b51’)
{
var monthReservation = new Date(e.data.NewReservation.StartDate).getMonth();
var monthReservationInsert = 1;
var yearReservation = new Date(e.data.NewReservation.StartDate).getFullYear();
var yearReservationInsert = 2014;
if((monthReservation == monthReservationInsert) && (yearReservation == yearReservationInsert))
{
s.body += e.bodyRaw;
return s;
}
}
}
}
})
I’m running this projection, it works fine the first time but doesn’t work when i delete and create it again. I’ve tried with the local interface 127.0.0.1:2113 and with an application .NET but i’ve always got the same errors.