mongodb-aggregation


MongoDB “$out” aggregation


Am using below pipeline:
m1 = {"$match" => {"analytic_id" => #analytic_id} }
p1 = {"$project"=> {"_id"=>0, "c_id"=> 1, "c_title"=>1, "view_time"=>1, "analytic_id"=>1 } }
g1 = {"$group"=> {"_id"=>"$c_id", "TVT"=> {"$sum"=>"$view_time" }, "c_title"=> {"$first"=> "$c_title"}, "analytic_id"=>{"$first" => "$analytic_id"} } }
p2 = {"$project"=> {"TVT"=> {"$divide"=> ["$TVT", 60] }, "c_id"=> 1, "c_title"=> 1, "analytic_id"=>1} }
s1 = {"$sort"=> {"TVT"=> -1}}
o1 = {"$out" => "reports" }
results = #pb.aggregate([m1, p1, g1, p2, s1, o1])
It is working fine. But "$out" will insert all the results in diferent collections. My concern is while creating I need to have created_at date also to be there.
Please help in this.
Thanks

Related Links

MongoDB “$out” aggregation
Count ocurrence of two fields

Categories

HOME
google-chrome
jboss
mod-rewrite
class
xcode
workflow
antd
nsview
embedded-resource
tabs
vue-resource
tfs2015
flurry
mithril.js
scheduler
anchor
mutation-testing
azure-graph-api
game-maker
freertos
tomcat8
asciimath
office-ui-fabric
jaspersoft-studio
string-formatting
bazaar
jest
angular2-highcharts
bsd
restier
pubxml
high-availability
morris.js
android-service
oracleforms
source-insight
autodesk-model-derivative
riotjs
lxml
gsp
ms-media-foundation
gnu-classpath
android-canvas
orchardcms-1.8
elastica
telephonymanager
python-sounddevice
classnotfoundexception
virtual-memory
expandablelistview
absolute
uiautomatorviewer
sonatype
embedded-v8
mongodb-aggregation
msxml
degrees
business-rules
wildfly-9
maatwebsite-excel
ipywidgets
conan
android-sdcard
frame-grab
mathnet
okta-api
stack-smash
espresso
replicaset
roxygen2
phpredis
web-api
uno
thoughtworks-go
encryption-symmetric
utf8-decode
rails-api
cpu-time
property-injection
mousemotionlistener
revmob
statechart
oscilloscope
jbox2d
background-thread
ofstream
cmath
ntlmv2
voice-recording
telerik-ajax
mkannotation
acpi
haiku
page-curl
solandra
urchin
getimagesize
fuzzy-comparison

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App