Hey there,
I am currently starting with using MongoDB for a project at my workingplace and decided to take these courses to learn more about it.
My program is written in python and uses pymongo for queries (it almost works as the shell, but there are some kinks to it). I have tried all my queries in the shell before using them in my program.
My problem is that the data is written into my MongoDB from an external program which is not under my control.
I work with data that roughly looks like this:
full_ret
[other documents]
return
type | statename | statelocation | pillar
run_num
The line
type | statename | statelocation | pillar
is different everytime and does not have a specific key that I can use to access it.
I want to sort my data (that is processed in my python program) by the field run_num
.
Is there any way that I can access it without knowing the key?
My Query looks like this:
db.saltReturns.find({},{"_id:0, [other documents]:0]"}).sort({“full_ret.return.[aynthing].run_num”})
(Might look a little bit different than what you are used to, because I use it in pymongo)