-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mongodb geospetial query doesnt work #13
Comments
The dict.items iterates over the key-value pairs of a dictionary. Therefore for
key, value in dictionary.items() will loop over each pair. This is
documented information and you can check it out in the official web page
<https://docs.python.org/3/library/stdtypes.html#dict>, or even easier,
open a python console and type help(dict.items). And now, just as an
example:
>> d = {'hello': 34, 'world': 2999}>>> for key, value in d.items():... print key, value
...
world 2999
hello 34
The AttributeError is an exception thrown when an object does not have the
attribute you tried to access. The class dict does not have any
predictors attribute
(now you know where to check it :) ), and therefore it complains when you
try to access it. As easy as that.
ср, 11 авг. 2021 г., 00:40 PeraZdera ***@***.***>:
… Hi,
i am trying to use mongodb geospetial query with sanic-motor.
Find with no arguments runs well and my query works in MongoDB Compass.
My query : await DataPoint.find({"location.cordinates": { '$nearSphere' :
{'$geometry': { type: "Point", 'coordinates': [20.44974230, 44.8772 ]
},'$minDistance': 0,'$maxDistance': 80}}})
Can you help me? I can't solve it.
[image: slika1]
<https://user-images.githubusercontent.com/51854326/128938684-b7c26533-b06e-4fc8-8484-7c6134a5c86a.png>
Thanks in advance,
Petar
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#13>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQ3BXAYBNMDP3YXD2WJYOM3T4GMFDANCNFSM5B44G6IQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
Thank you for your response, but i still can't get what is wrong with my query i think this package doesn't have support for this type of queries. |
did you miss quotes for |
Yes, i changed that but it still doesn't change anything. Your package helped me a lot, i managed to send data to mongo_db trough Sanic, and now i send qeospetial queries trough Django. |
you need use new version sanic. |
https://sanicframework.org/en/guide/basics/request.html#arguments https://motor.readthedocs.io/en/stable/api-asyncio/asyncio_motor_collection.html
|
@lixxu When i try this |
have you updated sanic to new version? |
closed as long time feedback. |
Hi,
i am trying to use mongodb geospetial query with sanic-motor.
Find with no arguments runs well and my query works in MongoDB Compass.
My query : await DataPoint.find({"location.cordinates": { '$nearSphere' : {'$geometry': { type: "Point", 'coordinates': [20.44974230, 44.8772 ] },'$minDistance': 0,'$maxDistance': 80}}})
Can you help me? I can't solve it.
Thanks in advance,
Petar
The text was updated successfully, but these errors were encountered: