We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have the following code:
next_job = yield self.scrapers_coll.find_one_and_update( {"state": "enqueued"}, { "$set": { "startTime": time.time(), } }, sort=[("createdOn", pymongo.ASCENDING)] )
This gives me a TypeError: list indices must be integers or slices, not str.
TypeError: list indices must be integers or slices, not str
From going through the source code it looks like TxMongo wants a different format than PyMongo. How do I specify the sort order in this case?
The text was updated successfully, but these errors were encountered:
Yes, txmongo has its own syntax for sort, hint and other query options:
from txmongo import filter next_job = yield self.scrapers_coll.find_one_and_update( {"state": "enqueued"}, { "$set": { "startTime": time.time(), } }, sort=filter.sort(filter.ASCENDING("createdOn")) )
This way you can sort by multiple fields:
filter.sort(filter.ASCENDING("priority") + filter.ASCENDING("createdOn"))
Sorry, something went wrong.
Any plans to update the code to support standard pymongo syntax too?
actually, sort= can also be specified like this:
sort=
sort=filter.sort(["createdOn", pymongo.ASCENDING])
Which is almost like in pymongo except wrapping with filter.sort
filter.sort
No branches or pull requests
I have the following code:
This gives me a
TypeError: list indices must be integers or slices, not str
.From going through the source code it looks like TxMongo wants a different format than PyMongo. How do I specify the sort order in this case?
The text was updated successfully, but these errors were encountered: