Query MongoDB with length criteria

后端 未结 4 537
南方客
南方客 2020-12-31 07:40

I have several documents in a MongoDB Collection, with a field \'name\' (which is a String).

How can I perform queries like 7 <= name.length <= 14

4条回答
  •  爱一瞬间的悲伤
    2020-12-31 08:11

    $where queries are not very efficient. MongoDB

    If this is a frequently executed query, you might want to store the length in a separate field. Denormalization

提交回复
热议问题