Mongo find by regex: return only matching string

前端 未结 2 1069
天命终不由人
天命终不由人 2021-01-14 15:13

My application has the following stack:

Sinatra on Ruby -> MongoMapper -> MongoDB

The application puts several entries in the database. In order to crosslink

2条回答
  •  孤街浪徒
    2021-01-14 16:01

    The way I solved this problem is using the string aggregation commands to extract the StartingIndexCP, ending indexCP and substrCP commands to extract the string I wanted. Since you could have multiple of these {} you need to have a projection to identify these CP indices in one shot and have another projection to extract the words you need. Hope this helps.

提交回复
热议问题