Calling a Projection Category returns an empty body

Hi,

I am trying to incorporate the eventstore in a private project to see if this can be used in our business applications. So far it seems like a cool piece of technology but unfortunatelly I am stuck in a tutorial that was done 5 years ago :wink:

What I have done is adding some events to a stream and splitting it up into categories. I have a “User” Stream that now is separated in streams categories by ID:

fromStream(‘UsersTest’)

.when(

{

$any : function(s,ev) { linkTo(‘TestUser-’ + ev.data.Id, ev);

}

});

I then made a projection “Users” that should allow me to querry the individual user like this:

fromCategory(‘TestUser’)

.foreachStream()

.when({

“$init”: function(state, ev) {

return {}

},

“UserCreatedEvent”: function(state, ev) {

return {

Id: ev.data.Id,

Name: ev.data.Name,

LastName: ev.data.LastName

}

},

“UserNameChangedEvent”: function(state, ev) {

return {

Id: ev.data.Id,

Name: ev.data.Name,

LastName: ev.data.LastName

}

}

})

What I expected that I could call the Projection above with this call: http://127.0.0.1:2113/projection/Users/state?partition=TestUser-4. But all I get is a 200 and no User object. I tried various permutaions of this projection URL like http://127.0.0.1:2113/projection/Users/state?partition=4 or http://127.0.0.1:2113/projection/Users but all I got is a 200 without a body. As the docs say, it should work like the first one, but it does not. Am I missing something here? Also am i right, that I would call the projection with the c# api like this: projectionsManager.GetPartitionResultAsync(“Users”, “5”)

This also just gives me an empty body, but I woul expect this as the projection does not return anything right now.

Also, is the “state” field on the web UI next to the projection a way to make this call with the UI? This also just return nothing, or is this not ment to set the state for a test?

Simon

I do not know if this is relevant or not, but the projection is stopped and when I try to start it, I get an error
An event emitted in recovery for stream $projections-Users-User-4-result differs from the originally emitted event. Existing(‘Result’, ‘:0/User-4:-1/3772674’). New(‘Result’, ‘:0/User-4:-1/3880553’)

But this goes away if I reset the projection. I found some Issues on Github on this and reset was the only solution so far. How is the state supposed to be? I mean, as I understood projections it is ok, if the are finished, as no new events are being processed. Or does the projection need to be active to be able to querry it?

Ok, I realized that the projection had to be continuoes, now it is running as expected. Is this true now? I can not find a explanation to single/continuous and why I have to use one over the other. The stream split for example can not be made continuous and so far I have to rerun it to split new events in the new streams as well. Is there another solution for this?