How to use $Count in mongodb

Multi tool use
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:
node.js mongodb count aggregation-framework
add a comment |
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:
node.js mongodb count aggregation-framework
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
add a comment |
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:
node.js mongodb count aggregation-framework
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:
node.js mongodb count aggregation-framework
node.js mongodb count aggregation-framework
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
add a comment |
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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