文本查询,q作为查询字符串:

coll.FindAsync<Foo>(Builders<Foo>.Filter.Text(q));

文本查询需要一个文本索引。要从C#创建代码,

coll.Indexes.CreateOneAsync(Builders<Foo>.IndexKeys.Text(p => p.Message));

附近查询:

coll.FindAsync<Foo>(Builders<Foo>.Filter.Near(p => p.Location, x, y, maxDis, minDis));
coll.FindAsync<Foo>(Builders<Foo>.Filter.Near(p => p.Location, 5, 5, 100, 0));

同样,这些需要索引:

coll.Indexes.CreateOneAsync(Builders<Foo>.IndexKeys.Geo2D(p => p.Location));

 

相关文章:

  • 2021-05-20
  • 2021-07-27
  • 2021-12-13
  • 2021-08-23
  • 2021-07-09
  • 2021-07-30
猜你喜欢
  • 2021-12-13
  • 2021-07-19
  • 2022-12-23
  • 2021-04-30
  • 2022-01-16
  • 2022-01-03
  • 2022-01-17
相关资源
相似解决方案