Problems with views- xamarin studio


When i try to create a view and set the map i always obtain a empty view as a result, with 0 rows. Furthermore when i’m in debug mode looking for the properties of the view, the values of these properties are Timed out. i don’t know what is going wrong, because i’m doing a simple view as you can see on the below code.

Format Document:

    Dictionary<string, object>{
    		{"nameRace", value},
    		{"number", value},
    		{"type", value},
    		{"athlete", value}

public void getDoc (){
	var vw = db.GetView ("running");
	vw.SetMap((document, emit) => {
	     emit("athlete", document["nameRace"]);
        var aux = vw.TotalRows;

I believe TotalRows returns the number of rows currently in the index. Since you’ve never queried this view (in the code shown), the index is still empty so TotalRows returns zero. If you query the view and then call TotalRows, it’ll return a valid number. (It would probably be better for TotalRows to update the index first; there’s discussion of that in a recent Github issue on the iOS version.)

BTW, your map function doesn’t make much sense. It’s emitting "athlete" as the key for every document, which isn’t going to be useful for querying anything. The key should be the thing you want to search for, so it looks like document["nameRace"] would be better as the key.


Hey jens, thank you for the answer! BTW i know my map function doesn’t make sense, it was a simple random example, anyway thanks for all!