cultherojoin #/r/webdev
culthero.. ffs
cultherojoin /#/r/webdev
cultherothere we go
mitescugdIs it possible to access the elements of a document returned by db.col.findOne()?
mitescugdi.e: "{'id':1, 'rel':[...]}", and I want to get the value of 'rel', that is, the array
KekSimitescugd: db.col.findOne().rel[0] will give you for example the first element in that array
mitescugdKekSi: thank you.
DearVoltHello everyone. I'm trying to get a simple aggregation working but I'm not having much luck. The function in my mongorc file looks like this: https://pastebin.com/M7t6de8B and each document in the collection has this structure: https://pastebin.com/P6hvCwLW - I've tried a few different things for the $group but not having much luck. It's also tricky debugging in the shell.
DearVoltWhen I try the aggregate on it's own in the shell (Not in the wrapper function) then it works fine.
DearVoltNevermind, figured it out. Using db instead of database... *facepalm*
vish(test)
RuddeSo I've been collecting data in a mongo database for a while now using the ISODate() type, can I extract that data and count the points for each minute?
Derickthrough Aggregation: https://docs.mongodb.com/manual/reference/operator/aggregation/minute/
DearVoltRudde: The examples on the reference page for the $group aggregate operator may be useful: https://docs.mongodb.com/manual/reference/operator/aggregation/group/#pipe._S_group
RuddeThanks, I will look into this!
RuddeI just started with mongo, didn't find eveyrhting in the doc to work as expected in the drivers
DearVoltRudde: Make sure you're using the documentation for the right version of MongoDB. Some of the documentation for older versions pops up in search results. This is a nice tutorial to help with aggregation: http://jessezhuang.github.io/article/mongodb-aggregation-framework/