# string-to-mongo-engine-operate **Repository Path**: jamesgan/string-to-mongo-engine-operate ## Basic Information - **Project Name**: string-to-mongo-engine-operate - **Description**: 使用字符串去执行mongo函数 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-04-17 - **Last Updated**: 2022-09-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 开发背景 项目中存在业务,用户在页面上输入字符串操作语句,后台代码进行执行。 ### 开发思路 使用java引擎进行函数式的执行。 主要工作:包装collection类,极其返回类的api包装 ### API MongoEngineActuator静态操作对象 参数:MongoCollection对象,字符串语句,结果提取器 ### Test MongoEngineActuator.run(collection, "insert({\"name\" :\"gan222\",\"age\":33})", cursorExtractor); MongoEngineActuator.run(collection, "find({name:\"james2\"}).limit(1)", cursorExtractor); MongoEngineActuator.run(collection, "aggregate([{$group : {_id : \"$by_user\", num_tutorial : {$first : 1}}}]);", cursorExtractor);