コード例 #1
0
# coding=utf-8
__author__ = 'wygdove'
__time__ = '2018/5/31 11:46'

from doveutils import dmongo

coll = dmongo.get_coll('10.1.234.150', '37017', 'dss001', 'dss001user',
                       'dss001pwd', 'gisfs')

coordinates = [[[117.338301, 39.176059], [117.395218, 39.161289],
                [117.41304, 39.199772], [117.338301, 39.176059]]]
query = {
    "geom": {
        "$geoWithin": {
            "$geometry": {
                "type": "Polygon",
                "coordinates": coordinates
            }
        }
    }
}
print dmongo.find_many(coll, query)
コード例 #2
0
ファイル: mongotest.py プロジェクト: wygdove/chan-dev-tool
# coding=utf-8
__author__ = 'wygdove'
__time__ = '2018/10/16 18:32'

from doveutils import dmongo
from bson.objectid import ObjectId

coll = dmongo.get_coll('10.19.10.79', '38017', 'dss001', 'dss001user',
                       'dss001pwd', 'gisfs')

type = "GIS-BUSICIRCLE"
query = {"tYPE": type}

# res=dmongo.find_one(coll,{"tYPE":type})
# res=dmongo.find_many(coll,{"tYPE":type})
# print res
# res=dmongo.delete_many(coll,query)
# if res!=None:print json.loads(res).__len__()

res = dmongo.find_many(coll, query)
print res

# id="5bc5c3e31bc137e93e2fe524"
# print coll.delete_one({"_id":ObjectId(id)})
# res=dmongo.find_withid(coll,id)
# print res