python 查询mongodb like语句怎么写

2025-02-23 23:30:35
推荐回答(2个)
回答1:

public class Server2 {

public static void main(String[] args) throws IOException {
System.out.println("Server is starting……");
ServerSocket server=new ServerSocket(8888);
while(true){
Socket s =server.accept();
System.out.println("Accepting connection……");
new ServerThread(s).start();
}
}
}
//定义Server线程

回答2:

模糊查询要用到re模块
import pymongo
import re
.........
#查询name字段中包含abc关键的数据
mycol.find({"name":re.compile('abc')})