mongodb - 是否有 mongodb 驱动程序可以在 .net 核心应用程序中使用 Atlas 搜索?
问题描述
我在我的 .net 核心应用程序中使用 MongoDB Atlas,使用 c# 驱动程序连接数据库,最近了解了 Atlas Search,我能够为我的集合创建索引,有没有办法使用 $searchbeta from我的应用程序来查询我的索引?
解决方案
您可以使用该aggregate
方法和BsonDocument.Parse
:
var pipeline = BsonDocument.Parse("{ $searchBeta: { search: { path: 'foo', query : 'bar' } }}");
var result = col.Aggregate<BsonDocument>(pipeline);
推荐阅读
- ruby-on-rails - Postgis 未在 Rails 应用程序中设置
- spring - 部署在 Google Cloud 上的 java 项目
- ubuntu - Ubuntu Trust OpenSSL 自签名证书
- python - 在 python 中,将 1970 年的秒数转换为 1900 年以来的小时数
- ignite - 通过 IgniteClient 将数据存储到 Ignite 缓存时抛出异常
- javascript - 如何从 Javascript 访问 Laravel Helper?
- node.js - Sequelize Node.js - 嵌套对象
- ios - 如何增加我的表格视图单元格的大小
- javascript - 在这种情况下如何使用 for 循环
- oracle - ORA-01841,(完整)年份必须介于