Such as: db. The userInfo. Find ({" age ": 22});
The db. The users. The save ({name: "zhangsan", the age: 25, sex: true});
Dynamic can parse, etc., how to perform these?
Like a JDBC SQL can directly call SQL statement execution ~
CodePudding user response:
As the similar structure of SQL statements, variable string concatenationCodePudding user response:
DBCollection collection=the getCollection (" yourCollection ");BasicDBObject document=new BasicDBObject ();
Document. The put (" id ", 1001);
Document. The put (" MSG ", "hello world mongo in Java")
The background is the need to know what conditions, not general, like SQL script directly,
CodePudding user response:
Try:https://blog.csdn.net/sl543001/article/details/102823055
Although the demo didn't write, but in fact support dynamic parameter