随笔 - 39  文章 - 16 评论 - 193 阅读 - 56550

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var clientConfiguration = GetConfiguration("couchbase.json");
            ClusterHelper.Initialize(clientConfiguration);
            var bucket = ClusterHelper.GetBucket("flamebucket");
            var bucketManager= bucket.CreateManager();
            bucketManager.CreateN1qlPrimaryIndex(false);
            bucket.Upsert("google:one", new Blog { Id = 1, BlogName = "i 1th blog" });
            bucket.Upsert("google:two", new Blog { Id = 2, BlogName = "i 2th blog" });
            bucket.Upsert("flame:three", new Blog { Id = 3, BlogName = "i 3th blog" });
            bucket.Upsert("ro:four", new Blog { Id = 4, BlogName = "i 4th blog" });
            bucket.Upsert("ro:five", new Blog { Id = 5, BlogName = "i 5th blog" });
            while (true)
            {
                Console.Clear();
                Console.WriteLine("please input google flame ro");
                string keyprefix = Console.ReadLine();
                if (keyprefix.StartsWith("q"))
                {
                    break;
                }
                var query = bucket.CreateQuery("flamedesigndoc", "allkeys", false).StartKey(keyprefix).EndKey(keyprefix+ "\ufff0");
                var result = bucket.Query<Blog>(query);
                 
                foreach (var row in result.Rows)
                {
                    Console.WriteLine("   key: "+row.Key);
                    Console.WriteLine("=====id:"+row.Value.Id +" blogName: "+ row.Value.BlogName);
                }
                Console.ReadLine();
            }
 
            
            Console.Read();

  

posted on   rosanshao  阅读(156)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
点击右上角即可分享
微信分享提示