Skip to content

a http server operate the mongodb write by golang

Notifications You must be signed in to change notification settings

sjqzhang/go-mongo-server

 
 

Repository files navigation

go-mongo-server

<title>API文档</title><style type="text/css"></style>

http请求目录

方法地址操作post body示例备注
帮助http://localhost:8010/GET
查询http://localhost:8010/getPOST{"Host":"","DBName":"spider","Business":"insocial","Data":{"zans":{"$gt":1}},"Limit":1,"Skip":1,"Select":{"id":1,"inid":1,"name":1}}
统计http://localhost:8010/countPOST{"Host":"","Business":"insocial","Data":{"zans":{"$gt":1}}
判断是否存在http://localhost:8010/existsPOST{"Business":"insocial","Data":{"id":"123456"},"Key":"id"}需指定主键key,否则默认为key为id
新增http://localhost:8010/addPOST{"Business":"insocial","Data":{"id":"123456","name":"123123"},"Key":"id"}Data值可以为map或者[]map
更新http://localhost:8010/updatePOST{"Business":"insocial","Data":{"id":"123456","name":"123123"},"Key":"id"}需指定主键key,否则默认为key为id

http post 参数详情

参数名称备注必选
Host服务器IP缺省为空,则为Server所在服务器,或者192.168.2.192:27027指定mongodb连接字符串
DBName数据库名称缺省为spider
Business表名
Data数据查询条件或者插入和更新的值
OrderBy排序条件time,+time,-time
Limit选取条数int型
Skip忽略条数int型
Select指定返回列{"time":1}
Key表主键缺省为id,在做插入或者更新的时候需要指定
Update更新标识bool类型,插入时如果已存在是否更新
Distinct去重查询标识string类型,根据string执行去重查询
LockKey占用的键用于并发获取数据,获取数据时先标识为-1,需同时指定key

About

a http server operate the mongodb write by golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%