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: and each document in the collection has this structure: - 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*
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:
DearVoltRudde: The examples on the reference page for the $group aggregate operator may be useful:
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: