Beispiel #1
0
 internal CouchListHandler(KeyValuePair<string, string> listDefinition, CouchDesignDocument designDocument)
 {
     DesignDocument = designDocument;
     Name = listDefinition.Key;
     Function = listDefinition.Value;
     HasPendingChanges = false;
 }
Beispiel #2
0
        public async Task <CouchEntityInfo> CreateDesign(string db, string name, IEnumerable <CouchViewDefinition> views)
        {
            Response response;

            try
            {
                var design = new CouchDesignDocument
                {
                    Id       = $"_design/{name}",
                    Language = "javascript",
                    Views    = views
                };

                response =
                    JsonConvert.DeserializeObject <Response>(await RequestDatabase(new Uri(_host, db), "POST",
                                                                                   JsonConvert.SerializeObject(design), "application/json"));
            }
            catch (Exception e)
            {
                throw new CouchException($"Cant create design document {db}/_design/{name}: {e.Message}", e);
            }

            if (response.Ok == false)
            {
                throw new CouchException($"Cant create design document {db}/_design/{name}: {response.Reason}");
            }

            return(new CouchEntityInfo {
                ETag = response.ETag, Id = response.EntityId
            });
        }
Beispiel #3
0
        public void ShouldHandleStreaming()
        {
            var design = new CouchDesignDocument("test", db);

            design.AddView("docs", "function (doc) { emit(null, null); } ");
            design.Synch();

            var doc = new CouchJsonDocument("{\"_id\":\"123\", \"CPU\": \"Intel\"}");

            db.SaveDocument(doc);

            var result = db.Query("test", "docs").StreamResult <CouchDocument>();

            Assert.That(result.FirstOrDefault() != null, "there should be one doc present");

            try
            {
                // this should throw an invalid operation exception
                result.FirstOrDefault();
            }
            finally
            {
                db.DeleteDocument(doc);
                db.DeleteDocument(design);
            }
        }
Beispiel #4
0
 internal CouchView(KeyValuePair<string, CouchViewDefinition> viewDefinition, CouchDesignDocument designDocument)
 {
     DesignDocument = designDocument;
     Name = viewDefinition.Key;
     Map = viewDefinition.Value.Map;
     Reduce = viewDefinition.Value.Reduce;
     HasPendingChanges = false;
 }
Beispiel #5
0
 internal CouchRewriteRule(CouchRewriteRuleDefinition rewriteRuleDefinition, CouchDesignDocument designDocument)
 {
     DesignDocument = designDocument;
     From = rewriteRuleDefinition.From;
     To = rewriteRuleDefinition.To;
     Method = rewriteRuleDefinition.Method;
     Query = rewriteRuleDefinition.Query;
 }
        public void Should_Start_CompactView()
        {
            var db = client.GetDatabase(baseDatabase);
            CouchDesignDocument doc = new CouchDesignDocument("test_compactview");

            doc.Views.Add("test", new CouchView("function(doc) { emit(null, doc) }"));
            db.CreateDocument(doc);

            db.CompactDocumentView("test_compactview");
        }
        public void Should_Run_TestView()
        {
            var db = client.GetDatabase(baseDatabase);

            db.CreateDocument("id1", "{}", new Result <string>()).Wait();
            CouchDesignDocument          doc    = new CouchDesignDocument("test_compactview");
            ViewResult <string, JObject> result = db.GetTempView <string, JObject>(new CouchView("function(doc) { emit(null, doc) }"));

            Assert.IsNotNull(result);
            Assert.AreEqual(DreamStatus.Ok, result.Status);
        }
        public void CreateViewDocument()
        {
            var db = client.GetDatabase(baseDatabase);
            CouchDesignDocument doc = new CouchDesignDocument("firstviewdoc");

            doc.Views.Add("all", new CouchView("function(doc) { emit(null, doc) }"));

            db.CreateDocument(doc);

            Assert.IsNotNull(doc.Rev);
        }
        public void DropShow()
        {
            _connectionMock = new Mock<ICouchConnection>(MockBehavior.Strict);
            _connectionMock.Setup(x => x.Put("unittest/_design/example", "{\"_id\":\"_design/example\",\"_rev\":\"1234\",\"language\":\"javascript\",\"shows\":{},\"lists\":{},\"rewrites\":[],\"updates\":{}}")).Returns(_httpResponse.Object);

            var svc = new CouchService(_connectionMock.Object);
            var db = svc["unittest"];
            var dd = new CouchDesignDocument(_designDocumentDefinition, db);
            dd.DropShow("testShow");

            Assert.AreEqual(0, dd.Shows.Count);
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            NSError error;

            window = new UIWindow(UIScreen.MainScreen.Bounds);
            window.MakeKeyAndVisible();
            dvc = new DialogViewController(new RootElement("CouchDemo")
            {
                new Section("Welcome")
            });
            window.RootViewController = new UINavigationController(dvc);

            server = new CouchTouchDBServer();
            if (server.Error != null)
            {
                Console.WriteLine("Error with the code: {0}", server.Error);
            }
            database = server.GetDatabase("grocery-sync");
            database.EnsureCreated(out error);
            database.TracksChanges = true;

            //
            // Create a view with documents sorted by date
            //
            design = database.DesignDocumentWithName("grocery");
            design.DefineView("byDate", (doc, emit) => {
                var date = doc ["created_at"];
                if (date != null)
                {
                    emit(date, doc);
                }
            }, "1.0");

            // Validation function requiring parseable dates
            design.SetValidationBlock((newRevision, context) => {
                if (newRevision.Deleted)
                {
                    return(true);
                }
                var date = newRevision.Properties ["created_at"];
                if (date != null && RestBody.DateWithJSONObject(date) == null)
                {
                    context.ErrorMessage = "Invalid date";
                    return(false);
                }
                return(true);
            });

            AddNewItem();

            return(true);
        }
        public void CreateShow()
        {
            var db = client.GetDatabase(baseDatabase);

            JDocument d = new JDocument(@"{""title"": ""some title""}");

            d.Id = "sampleid";
            db.CreateDocument(d);

            CouchDesignDocument doc = new CouchDesignDocument("showdoc");

            doc.Shows.Add("simple", "function(doc, req) {return '<h1>' + doc.title + '</h1>';}");
            db.CreateDocument(doc);
        }
Beispiel #12
0
        private static async Task RunListOnView()
        {
            //Add content here to show usage
            var design = new CouchDesignDocument();

            design.ID = "listtesting";
            design.Views.Add("listview", new CouchView()
            {
                Map = "function (doc) {emit(doc._id, doc);}"
            });
            design.Lists.Add("list", "function(head,req){start();var filtered=[];while(row=getRow()){filtered.push(row.value);}send(toJSON(filtered));}");
            await client.UpsertDesignDocumentAsync(design);

            var result = await client.GetListFromViewAsync <List <Person> >("listtesting", "list", "listview", null);
        }
Beispiel #13
0
        public static void UpdateDesignDocuments(CouchDatabase db)
        {
            var view = new CouchDesignDocument("explosionview");

            foreach (var pair in views)
            {
                var processed = pair.Value.Replace("$MODEL_NAME", typeof(Note).Name);
                view.Views.Add(pair.Key, new CouchView(processed));
            }

            db.CreateDocument(view, new Result <CouchDesignDocument>()).WhenDone((designDocument) => {
                Console.Out.WriteLine("Successfully written design doc!");
            }, (designDocumentError) => {
                Console.Out.WriteLine("Hah, couldn't write design doc: " + designDocumentError.Message);
            });
        }
        public void CreateView()
        {
            _connectionMock = new Mock<ICouchConnection>(MockBehavior.Strict);

            var svc = new CouchService(_connectionMock.Object);
            var db = svc["unittest"];

            var dd = new CouchDesignDocument("example", db);
            var view = dd.CreateView("testView");

            Assert.IsAssignableFrom<CouchView>(view);
            Assert.IsNull(view.Map);
            Assert.IsNull(view.Reduce);
            Assert.IsTrue(view.HasPendingChanges);
            Assert.AreEqual("testView",view.Name);
        }
        public void CreateShow()
        {
            _connectionMock = new Mock<ICouchConnection>(MockBehavior.Strict);

            var svc = new CouchService(_connectionMock.Object);
            var db = svc["unittest"];

            var dd = new CouchDesignDocument("example", db);
            var show = dd.CreateShow("testShow");

            Assert.IsAssignableFrom<CouchShowHandler>(show);
            Assert.IsNull(show.Function);
            Assert.IsTrue(show.HasPendingChanges);
            Assert.AreEqual("testShow", show.Name);
            Assert.AreEqual(dd,show.DesignDocument);
            Assert.AreEqual("_design/example/_show/testShow", show.ToString());
        }
        public void CreateValidateDocUpdate()
        {
            const string validationFunction = "function(newDoc, oldDoc, userCtx) {}";

            var db = client.GetDatabase(baseDatabase);

            CouchDesignDocument doc = new CouchDesignDocument("validationFunction");

            doc.ValidateDocUpdate = validationFunction;
            db.CreateDocument(doc);

            JDocument jd = db.GetDocument <JDocument>(doc.Id);

            Assert.AreEqual(validationFunction, jd.Value <string>("validate_doc_update"));

            db.DeleteDocument(jd);
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            NSError error;

            window = new UIWindow (UIScreen.MainScreen.Bounds);
            window.MakeKeyAndVisible ();
            dvc = new DialogViewController (new RootElement ("CouchDemo") {
                new Section ("Welcome")
            });
            window.RootViewController = new UINavigationController (dvc);

            server = new CouchTouchDBServer ();
            if (server.Error != null){
                Console.WriteLine ("Error with the code: {0}", server.Error);
            }
            database = server.GetDatabase ("grocery-sync");
            database.EnsureCreated (out error);
            database.TracksChanges = true;

            //
            // Create a view with documents sorted by date
            //
            design = database.DesignDocumentWithName ("grocery");
            design.DefineView ("byDate", (doc,emit) => {
                var date = doc ["created_at"];
                if (date != null)
                    emit (date, doc);
            }, "1.0");

            // Validation function requiring parseable dates
            design.SetValidationBlock ((newRevision,context)=>{
                if (newRevision.Deleted)
                    return true;
                var date = newRevision.Properties ["created_at"];
                if (date != null && RestBody.DateWithJSONObject (date) == null){
                    context.ErrorMessage = "Invalid date";
                    return false;
                }
                return true;
            });

            AddNewItem ();

            return true;
        }
Beispiel #18
0
        private async Task _CreateDesign()
        {
            var client = GetTestClient();
            //Create document with two views
            var designDoc = new CouchDesignDocument();

            designDoc.ID = "testDesignDoc";
            designDoc.AddView("test", "function (doc) {emit(doc._id, 1);}");
            designDoc.AddView("testReduce", "function (doc) {emit(doc._id, 1);}", "_count");
            designDoc.AddUpdate("testupdate", "function(document,request){return [null, 'Edited World!'];}");
            var result = await client.UpsertDesignDocumentAsync(designDoc);

            Assert.True(result.Ok);
            Assert.True(!string.IsNullOrEmpty(designDoc.Rev), "Revision was not set during creation");
            Assert.True(designDoc.ID.StartsWith(CouchEntryPoints.DesignDoc), "New created design document doesnt start with _design");
            Assert.False(designDoc.Deleted, "Design document is marked as deleted!");
            LastDesignDoc = designDoc;
        }
Beispiel #19
0
        private Yield LoadContactsHelper(Result <ViewResult <string, string, Contact> > aResult)
        {
            Result <bool> exists = new Result <bool>();

            yield return(theDatabase.DocumentExists("_design/contactview", exists));

            if (exists.HasException)
            {
                aResult.Throw(exists.Exception);
                yield break;
            }

            if (!exists.Value)
            {
                CouchDesignDocument view = new CouchDesignDocument("contactview");
                view.Views.Add("all",
                               new CouchView(
                                   @"function(doc){
				                       if(doc.type && doc.type == 'contact'){
				                          emit(doc.lastName, doc.firstName)
				                       }
				                    }"                ));

                Result <CouchDesignDocument> creationResult = new Result <CouchDesignDocument>();
                yield return(theDatabase.CreateDocument(view, creationResult));

                if (creationResult.HasException)
                {
                    aResult.Throw(creationResult.Exception);
                    yield break;
                }
            }

            var viewRes = new Result <ViewResult <string, string, Contact> >();

            yield return(theDatabase.GetView("contactview", "all", viewRes));

            if (viewRes.HasException)
            {
                aResult.Throw(viewRes.Exception);
                yield break;
            }
            aResult.Return(viewRes.Value);
        }
		public static void Setup(TestContext o)
#endif
		{
			client = new CouchClient(aHost: couchdbHostName);

			if (client.HasDatabase(baseDatabase))
			{
				client.DeleteDatabase(baseDatabase);
			}
			client.CreateDatabase(baseDatabase);

			if (client.HasDatabase(replicateDatabase))
			{
				client.DeleteDatabase(replicateDatabase);
			}
			client.CreateDatabase(replicateDatabase);

			CouchDatabase db = client.GetDatabase(baseDatabase);
			CouchDesignDocument view = new CouchDesignDocument("testviewitem");
			view.Views.Add("testview", new CouchView("function(doc) {emit(doc._rev, doc)}"));
			db.CreateDocument(view);

		}
        public static void Setup(TestContext o)
#endif
        {
            client = new CouchClient(aHost: couchdbHostName);

            if (client.HasDatabase(baseDatabase))
            {
                client.DeleteDatabase(baseDatabase);
            }
            client.CreateDatabase(baseDatabase);

            if (client.HasDatabase(replicateDatabase))
            {
                client.DeleteDatabase(replicateDatabase);
            }
            client.CreateDatabase(replicateDatabase);

            CouchDatabase       db   = client.GetDatabase(baseDatabase);
            CouchDesignDocument view = new CouchDesignDocument("testviewitem");

            view.Views.Add("testview", new CouchView("function(doc) {emit(doc._rev, doc)}"));
            db.CreateDocument(view);
        }
Beispiel #22
0
        public async Task <CouchEntityInfo> PutDesign(string db, CouchDesignDocument couchDesign)
        {
            Response response;

            try
            {
                response =
                    JsonConvert.DeserializeObject <Response>(await RequestDatabase(new Uri(_host, $"{db}/_design/{couchDesign.Name}"), "PUT",
                                                                                   JsonConvert.SerializeObject(couchDesign)));
            }
            catch (Exception e)
            {
                throw new CouchException($"Can`t create view {db}/_design/{couchDesign.Name} : {e.Message}", e);
            }

            if (response.Ok == false)
            {
                throw new CouchException($"Can`t create view {db}/_design/{couchDesign.Name} : {response.Reason}");
            }

            return(new CouchEntityInfo {
                ETag = response.ETag, Id = response.EntityId
            });
        }
        public void InternalCreate_Full()
        {
            _connectionMock = new Mock<ICouchConnection>(MockBehavior.Strict);
            var svc = new CouchService(_connectionMock.Object);
            var db = svc["unittest"];

            var dd = new CouchDesignDocument(_designDocumentDefinition, db);

            Assert.AreEqual(_designDocumentDefinition.Id, dd.Id);
            Assert.AreEqual(_designDocumentDefinition.Revision, dd.Revision);
            Assert.AreEqual(1, dd.Views.Count);
            Assert.AreEqual(1, dd.Shows.Count);
            Assert.AreEqual(1, dd.Lists.Count);
            Assert.AreEqual(1, dd.RewriteRules.Count);
            Assert.AreEqual(1, dd.DocumentUpdaters.Count);
            Assert.AreEqual("example", dd.Name);
        }
Beispiel #24
0
 public CouchListHandler(string listName, CouchDesignDocument designDocument)
 {
     Name = listName;
     DesignDocument = designDocument;
     HasPendingChanges = true;
 }
        public void PublicCreate_WithDesignInName_ShouldFormatName()
        {
            _connectionMock = new Mock<ICouchConnection>(MockBehavior.Strict);

            var svc = new CouchService(_connectionMock.Object);
            var db = svc["unittest"];

            var dd = new CouchDesignDocument("_design/example", db);
            Assert.AreEqual("example", dd.Name);
        }
        public void PublicCreate()
        {
            _connectionMock = new Mock<ICouchConnection>(MockBehavior.Strict);

            var svc = new CouchService(_connectionMock.Object);
            var db = svc["unittest"];

            var dd = new CouchDesignDocument("example", db);

            Assert.IsNotNull(dd);
            Assert.AreEqual("_design/example",dd.Id);
            Assert.AreEqual(0,dd.Views.Count);
            Assert.AreEqual(0,dd.Shows.Count);
            Assert.AreEqual(0,dd.Lists.Count);
            Assert.AreEqual(0,dd.RewriteRules.Count);
            Assert.AreEqual(0,dd.DocumentUpdaters.Count);
            Assert.IsTrue(dd.HasPendingChanges);
            Assert.AreEqual("javascript",dd.Language);
            Assert.IsNull(dd.Revision);
            Assert.AreEqual("example",dd.Name);
        }
        public void RunTestView()
        {
            // Arrange
              _db.CreateDocument("id1", "{}", new Result<string>()).Wait();

              // Act
              CouchDesignDocument doc = new CouchDesignDocument("test_compactview");
              ViewResult<string, JObject> result = _db.GetTempView<string, JObject>(
            new CouchView("function(doc) { emit(null, doc) }"));

              // Assert
              Assert.IsNotNull(result);
              Assert.AreEqual(DreamStatus.Ok, result.Status);
        }
        public void CreateViewDocument()
        {
            // Act
              CouchDesignDocument view = new CouchDesignDocument("testviewitem");
              view.Views.Add("testview",
            new CouchView("function(doc) {emit(doc._rev, doc)}"));
              _db.CreateDocument(view);

              // Assert
              Assert.IsNotNull(view.Rev);
        }
Beispiel #29
0
        public void ShouldHandleStreaming()
        {
            var design = new CouchDesignDocument("test", db);
            design.AddView("docs", "function (doc) { emit(null, null); } ");
            design.Synch();

            var doc = new CouchJsonDocument("{\"_id\":\"123\", \"CPU\": \"Intel\"}");
            db.SaveDocument(doc);

            var result = db.Query("test", "docs").StreamResult<CouchDocument>();

            Assert.That(result.FirstOrDefault() != null, "there should be one doc present");

            try
            {
                // this should throw an invalid operation exception
                result.FirstOrDefault();
            }
            finally
            {
                db.DeleteDocument(doc);
                db.DeleteDocument(design);
            }
        }
        public void RunUpdateHandlerWithDocumentResponse()
        {
            // Arrange
              CouchDesignDocument view = new CouchDesignDocument("design");
              view.Updates["test"] = @"function(doc, req) {
            doc = {'_id': req.uuid, 'testval': 'OK'}; return [doc, toJSON(doc)]; }";
              _db.CreateDocument(view);

              // Act
              UpdateDocResponse<TestSubClass> response =
            _db.UpdateHandle<UpdateDocResponse<TestSubClass>>("design", "test");

              // Assert
              Assert.IsNotNull(response.Rev);
              Assert.IsNotNull(response.Response.Id);
              Assert.IsNotNull(response.Response.TESTVAL);
              Assert.AreEqual("OK", response.Response.TESTVAL);
        }
		public void CreateShow()
		{
			var db = client.GetDatabase(baseDatabase);

			JDocument d = new JDocument(@"{""title"": ""some title""}");
			d.Id = "sampleid";
			db.CreateDocument(d);

			CouchDesignDocument doc = new CouchDesignDocument("showdoc");
			doc.Shows.Add("simple", "function(doc, req) {return '<h1>' + doc.title + '</h1>';}");
			db.CreateDocument(doc);
		}
		public void CreateValidateDocUpdate()
		{
			const string validationFunction = "function(newDoc, oldDoc, userCtx) {}";

			var db = client.GetDatabase(baseDatabase);

			CouchDesignDocument doc = new CouchDesignDocument("validationFunction");
			doc.ValidateDocUpdate = validationFunction;
			db.CreateDocument(doc);

			JDocument jd = db.GetDocument<JDocument>(doc.Id);
			Assert.AreEqual(validationFunction, jd.Value<string>("validate_doc_update"));

			db.DeleteDocument(jd);
		}
		public void Should_Run_TestView()
		{
			var db = client.GetDatabase(baseDatabase);
			db.CreateDocument("id1", "{}", new Result<string>()).Wait();
			CouchDesignDocument doc = new CouchDesignDocument("test_compactview");
			ViewResult<string, JObject> result = db.GetTempView<string, JObject>(new CouchView("function(doc) { emit(null, doc) }"));

			Assert.IsNotNull(result);
			Assert.AreEqual(DreamStatus.Ok, result.Status);
		}
		public void Should_Start_CompactView()
		{
			var db = client.GetDatabase(baseDatabase);
			CouchDesignDocument doc = new CouchDesignDocument("test_compactview");
			doc.Views.Add("test", new CouchView("function(doc) { emit(null, doc) }"));
			db.CreateDocument(doc);

			db.CompactDocumentView("test_compactview");
		}
Beispiel #35
0
 public CouchShowDefinition(string name, string list, CouchDesignDocument doc)
     : base(name, doc)
 {
     Show = list;
 }
Beispiel #36
0
 public CouchView(string viewName, CouchDesignDocument designDocument)
 {
     Name = viewName;
     DesignDocument = designDocument;
     HasPendingChanges = true;
 }
Beispiel #37
0
 public CouchListDefinition(string name, string list, CouchDesignDocument doc)
     : base(name, doc)
 {
     List = list;
 }
        public void RunUpdateHandlerWithDocumentId()
        {
            // Arrange
              _db.CreateDocument(@"{""_id"":""test_id"", ""test"":""Works!""}");
              CouchDesignDocument view = new CouchDesignDocument("design");
              view.Updates["test"] = @"function(doc, req) { return [doc, doc.test]; }";
              _db.CreateDocument(view);

              // Act
              UpdateHttpResponse response =
            _db.UpdateHandle<UpdateHttpResponse>("design", "test", "test_id");

              // Assert
              Assert.AreEqual("Works!", response.HttpResponse);
        }
Beispiel #39
0
 /// <summary>
 /// Constructor used for permanent views, see CouchDesignDocument.
 /// </summary>
 /// <param name="name">View name.</param>
 /// <param name="index">Index function.</param>
 /// <param name="doc">Parent document.</param>
 public CouchLuceneViewDefinition(string name, string index, CouchDesignDocument doc) : base(name, doc)
 {
     Index = index;
 }
        public void RunUpdateHandlerWithJsonResponse()
        {
            // Arrange
              CouchDesignDocument view = new CouchDesignDocument("design");
              view.Updates["test"] = @"function(doc, req) {
            doc = {'_id': req.uuid, 'test': 'OK'}; return [doc, toJSON(doc)]; }";
              _db.CreateDocument(view);

              // Act
              UpdateJsonResponse response =
            _db.UpdateHandle<UpdateJsonResponse>("design", "test");

              // Assert
              Assert.IsNotNull(response.Rev);
              Assert.IsNotNull(response.Response["_id"]);
              Assert.IsNotNull(response.Response["test"]);
              Assert.AreEqual("OK", response.Response["test"]);
        }
        public void RunUpdateHandlerWithHttpResponseAndRevision()
        {
            // Arrange
              CouchDesignDocument view = new CouchDesignDocument("design");
              view.Updates["test"] = @"function(doc, req) {
            doc = {'_id': req.uuid}; return [doc, 'OK']; }";
              _db.CreateDocument(view);

              // Act
              UpdateHttpResponse response =
            _db.UpdateHandle<UpdateHttpResponse>("design", "test");

              // Assert
              Assert.IsNotNull(response.Rev);
              Assert.AreEqual("OK", response.HttpResponse);
        }
Beispiel #42
0
 public CouchShowDefinition(string name, CouchDesignDocument doc)
     : base(name, doc)
 {
 }
        public void RunUpdateHandlerWithRequestData()
        {
            // Arrange
              CouchDesignDocument view = new CouchDesignDocument("design");
              view.Updates["test"] = @"function(doc, req) {
            var data = JSON.parse(req.body);
            return [null, data.test]; }";
              _db.CreateDocument(view);

              // Act
              UpdateHttpResponse response = _db.UpdateHandle<UpdateHttpResponse>(
            "design", "test", JObject.Parse(@"{""test"":""Works!""}"));

              // Assert
              Assert.AreEqual("Works!", response.HttpResponse);
        }
Beispiel #44
0
 /// <summary>
 /// Basic constructor used in ReadJson() etc.
 /// </summary>
 /// <param name="name">View name used in URI.</param>
 /// <param name="doc">A design doc, can also be created on the fly.</param>
 public CouchLuceneViewDefinition(string name, CouchDesignDocument doc) : base(name, doc)
 {
 }
Beispiel #45
0
 protected CouchViewDefinitionBase(string name, CouchDesignDocument doc)
 {
     Doc  = doc;
     Name = name;
 }
Beispiel #46
0
 protected CouchViewDefinitionBase(string name, CouchDesignDocument doc)
 {
     Doc = doc;
     Name = name;
 }
		public void CreateViewDocument()
		{
			var db = client.GetDatabase(baseDatabase);
			CouchDesignDocument doc = new CouchDesignDocument("firstviewdoc");
			doc.Views.Add("all", new CouchView("function(doc) { emit(null, doc) }"));

			db.CreateDocument(doc);

			Assert.IsNotNull(doc.Rev);
		}