Subject: [mongodb-user] Pass Values in Mongo Query from
Text file



I am trying to get the group by and sum from a mongo collection using below query

db.getCollection('racts').aggregate([
{$match:
{    conId: {"$in": ["C:1335", "C:22478"]},
     Ttile: "Right"
     } },
{"$group" : {_id:"$conId", count:{$sum:1}}}
])

I am able to get the desired result but I want the value of conId to be pulled from another text or js file . Something like

   conId: {"$in": `cat value.txt`},


tretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41);">I know cat wont here but I am using that just to explain.

Can anyone help me with same ?

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/fb271b15-30df-4296-b6d8-0de9e223f54a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



Programming list archiving by: Enterprise Git Hosting