首页 > 解决方案 > 是否有 mongodb 驱动程序可以在 .net 核心应用程序中使用 Atlas 搜索?

问题描述

我在我的 .net 核心应用程序中使用 MongoDB Atlas,使用 c# 驱动程序连接数据库,最近了解了 Atlas Search,我能够为我的集合创建索引,有没有办法使用 $searchbeta from我的应用程序来查询我的索引?

标签: mongodbmongodb-.net-drivermongodb-atlasmongodb-atlas-search

解决方案


您可以使用该aggregate方法和BsonDocument.Parse

var pipeline = BsonDocument.Parse("{ $searchBeta: { search: { path: 'foo', query : 'bar' } }}");
var result = col.Aggregate<BsonDocument>(pipeline);

推荐阅读