How to use $Count in mongodb

Multi tool use
Multi tool use












0














I have a collections as bellow:



{ "_id" : ObjectId("5c2493935634e4300000000c"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 15:55:43", "endtime" : "2018-12-27 15:55:46", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-00000018", "destinationchannel" : "SIP/22000-00000019", "uniqueid" : "1545900943.24" }
{ "_id" : ObjectId("5c2498915634e4300000000d"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:17:02", "endtime" : "2018-12-27 16:17:05", "source" : "21000", "destination" : "22000", "duration" : "2", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001a", "destinationchannel" : "SIP/22000-0000001b", "uniqueid" : "1545902222.26" }
{ "_id" : ObjectId("5c2498e25634e4300000000e"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:18:23", "endtime" : "2018-12-27 16:18:26", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001c", "destinationchannel" : "SIP/22000-0000001d", "uniqueid" : "1545902303.28" }
{ "_id" : ObjectId("5c24990d5634e4300000000f"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:19:05", "endtime" : "2018-12-27 16:19:09", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001e", "destinationchannel" : "SIP/22000-0000001f", "uniqueid" : "1545902345.30" }


How to export the table as shown below:



enter image description here










share|improve this question
























  • Please post the expected JSON output instead screenshot
    – Anthony Winzlet
    Dec 28 '18 at 5:16












  • This is JSON Output examples: { "_id" : "21000", "date" : "2018-12-27", "totalIncomingCall" : "0", "totalOutgoingCall" : "0", "totalDuration" : "0", "totalBillsec" : "0" } @AnthonyWinzlet
    – Mr Dong
    Dec 28 '18 at 8:05












  • Not getting your question
    – Anthony Winzlet
    Dec 28 '18 at 9:52
















0














I have a collections as bellow:



{ "_id" : ObjectId("5c2493935634e4300000000c"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 15:55:43", "endtime" : "2018-12-27 15:55:46", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-00000018", "destinationchannel" : "SIP/22000-00000019", "uniqueid" : "1545900943.24" }
{ "_id" : ObjectId("5c2498915634e4300000000d"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:17:02", "endtime" : "2018-12-27 16:17:05", "source" : "21000", "destination" : "22000", "duration" : "2", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001a", "destinationchannel" : "SIP/22000-0000001b", "uniqueid" : "1545902222.26" }
{ "_id" : ObjectId("5c2498e25634e4300000000e"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:18:23", "endtime" : "2018-12-27 16:18:26", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001c", "destinationchannel" : "SIP/22000-0000001d", "uniqueid" : "1545902303.28" }
{ "_id" : ObjectId("5c24990d5634e4300000000f"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:19:05", "endtime" : "2018-12-27 16:19:09", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001e", "destinationchannel" : "SIP/22000-0000001f", "uniqueid" : "1545902345.30" }


How to export the table as shown below:



enter image description here










share|improve this question
























  • Please post the expected JSON output instead screenshot
    – Anthony Winzlet
    Dec 28 '18 at 5:16












  • This is JSON Output examples: { "_id" : "21000", "date" : "2018-12-27", "totalIncomingCall" : "0", "totalOutgoingCall" : "0", "totalDuration" : "0", "totalBillsec" : "0" } @AnthonyWinzlet
    – Mr Dong
    Dec 28 '18 at 8:05












  • Not getting your question
    – Anthony Winzlet
    Dec 28 '18 at 9:52














0












0








0







I have a collections as bellow:



{ "_id" : ObjectId("5c2493935634e4300000000c"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 15:55:43", "endtime" : "2018-12-27 15:55:46", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-00000018", "destinationchannel" : "SIP/22000-00000019", "uniqueid" : "1545900943.24" }
{ "_id" : ObjectId("5c2498915634e4300000000d"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:17:02", "endtime" : "2018-12-27 16:17:05", "source" : "21000", "destination" : "22000", "duration" : "2", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001a", "destinationchannel" : "SIP/22000-0000001b", "uniqueid" : "1545902222.26" }
{ "_id" : ObjectId("5c2498e25634e4300000000e"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:18:23", "endtime" : "2018-12-27 16:18:26", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001c", "destinationchannel" : "SIP/22000-0000001d", "uniqueid" : "1545902303.28" }
{ "_id" : ObjectId("5c24990d5634e4300000000f"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:19:05", "endtime" : "2018-12-27 16:19:09", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001e", "destinationchannel" : "SIP/22000-0000001f", "uniqueid" : "1545902345.30" }


How to export the table as shown below:



enter image description here










share|improve this question















I have a collections as bellow:



{ "_id" : ObjectId("5c2493935634e4300000000c"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 15:55:43", "endtime" : "2018-12-27 15:55:46", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-00000018", "destinationchannel" : "SIP/22000-00000019", "uniqueid" : "1545900943.24" }
{ "_id" : ObjectId("5c2498915634e4300000000d"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:17:02", "endtime" : "2018-12-27 16:17:05", "source" : "21000", "destination" : "22000", "duration" : "2", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001a", "destinationchannel" : "SIP/22000-0000001b", "uniqueid" : "1545902222.26" }
{ "_id" : ObjectId("5c2498e25634e4300000000e"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:18:23", "endtime" : "2018-12-27 16:18:26", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001c", "destinationchannel" : "SIP/22000-0000001d", "uniqueid" : "1545902303.28" }
{ "_id" : ObjectId("5c24990d5634e4300000000f"), "typeCall" : "Internal", "date" : "2018-12-27", "starttime" : "2018-12-27 16:19:05", "endtime" : "2018-12-27 16:19:09", "source" : "21000", "destination" : "22000", "duration" : "3", "billsec" : "0", "disposition" : "NO ANSWER", "channel" : "SIP/21000-0000001e", "destinationchannel" : "SIP/22000-0000001f", "uniqueid" : "1545902345.30" }


How to export the table as shown below:



enter image description here







node.js mongodb count aggregation-framework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 28 '18 at 10:14









VinothRaja

1,053416




1,053416










asked Dec 28 '18 at 3:23









Mr Dong

82




82












  • Please post the expected JSON output instead screenshot
    – Anthony Winzlet
    Dec 28 '18 at 5:16












  • This is JSON Output examples: { "_id" : "21000", "date" : "2018-12-27", "totalIncomingCall" : "0", "totalOutgoingCall" : "0", "totalDuration" : "0", "totalBillsec" : "0" } @AnthonyWinzlet
    – Mr Dong
    Dec 28 '18 at 8:05












  • Not getting your question
    – Anthony Winzlet
    Dec 28 '18 at 9:52


















  • Please post the expected JSON output instead screenshot
    – Anthony Winzlet
    Dec 28 '18 at 5:16












  • This is JSON Output examples: { "_id" : "21000", "date" : "2018-12-27", "totalIncomingCall" : "0", "totalOutgoingCall" : "0", "totalDuration" : "0", "totalBillsec" : "0" } @AnthonyWinzlet
    – Mr Dong
    Dec 28 '18 at 8:05












  • Not getting your question
    – Anthony Winzlet
    Dec 28 '18 at 9:52
















Please post the expected JSON output instead screenshot
– Anthony Winzlet
Dec 28 '18 at 5:16






Please post the expected JSON output instead screenshot
– Anthony Winzlet
Dec 28 '18 at 5:16














This is JSON Output examples: { "_id" : "21000", "date" : "2018-12-27", "totalIncomingCall" : "0", "totalOutgoingCall" : "0", "totalDuration" : "0", "totalBillsec" : "0" } @AnthonyWinzlet
– Mr Dong
Dec 28 '18 at 8:05






This is JSON Output examples: { "_id" : "21000", "date" : "2018-12-27", "totalIncomingCall" : "0", "totalOutgoingCall" : "0", "totalDuration" : "0", "totalBillsec" : "0" } @AnthonyWinzlet
– Mr Dong
Dec 28 '18 at 8:05














Not getting your question
– Anthony Winzlet
Dec 28 '18 at 9:52




Not getting your question
– Anthony Winzlet
Dec 28 '18 at 9:52












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53953326%2fhow-to-use-count-in-mongodb%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53953326%2fhow-to-use-count-in-mongodb%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







oCt,yVATJKVIvFmVL5oXs8bqAS8,cH,MjOj,Y,w2 SNRQ71DE5rxM8rs,1 eahOXRJKddaClMovO
g40w9Gd2G qnK1l z0T Ukb,X2 z45CT dUwYDoxjM7b7foiosCdW6d61m

Popular posts from this blog

Monofisismo

compose and upload a new article using a custom form

“attempting to read past stream EOM” using Sybase.AdoNet4.AseClient