Unity - Views never running map function

Hello!

I’ve been trying to create a client view using couchbase-lite-net in Unity. All is well so far, but I’ve been unable to get Views working. The View object is created without issue, but the view never seems to index.

    View v = db.GetView ("myTestView");
    v.SetMap ((doc, emit) => {
         Debug.Log ("Map function called");
         emit(doc, doc);
    }, "1");

The debug message never appears, and the IsStale property reads true. Is there some other step I need to take to kick off indexing?

Have you created a query and run it on your view?

I’ve narrowed down the issue. Consider the following code, right after the block from the first post.

Query q = v.CreateQuery ();
q.Limit = 0; 
var results = q.Run ();
foreach (QueryRow result in results) {
	Debug.Log ("Query returned result: " + result.DocumentId);
}

This returns an empty list of results, even after indexing successfully. If I comment out the “q.Limit = 0” line, it returns results successfully. The Couchbase docs say that a value of 0 for Limit means “unlimited.” Could this be a bug in Unity beta1?

Thanks!

That seems like a docs mistake to me (should be “the default value is” without specifying the default value). If you want unlimited documents, just simply leave that property as it is. I don’t think other platforms have the behavior of 0 == unlimited either, but I will confirm.