MongoDB filtering

Hi.

Trying to extract data from a mongoDB Database. Have succeeded to extrakt all the data from a database. But it is a lot of data. Can I filter somehow. From the attached picture I want only Objektid that contains "name" : "system.operator.login.ok",

Have used mongodb2 and mongodb3

/Regards Niclas

I have not used MongoDB but I would have expected that you could request only those records when querying the database.

Hi Nicas,

You can use Mongodb's aggregation to filter out the matching records.
In a preceding Function node :

msg.collection = "events"
msg.operation = "aggregate"

msg.payload = [

{ "$match": { "name": "system.operator.login.ok" } },

//{ "$sort": { dt: -1}},
//{"$limit": 2},
//{"$skip": 0}
];

return msg;

The above is untested since we dont have you're db but i hope it gives you the result you want
ps. im using node-red-node-mongodb