How can i use regex in mongodb over mongolab?

前端 未结 1 1530
礼貌的吻别
礼貌的吻别 2021-01-16 16:39

My question is simple but i can not find exact solution. All articles have gor below a line of code:

collection.findOne({hello:\'world_no_safe\'});

Above cod

1条回答
  •  鱼传尺愫
    2021-01-16 17:13

    According to the MongoDB Manual you can use the $regex operator:

    collection.findOne({Name: { $regex: '.*world_no_safe.*' }});
    

    0 讨论(0)
提交回复
热议问题