Skip to content

Instantly share code, notes, and snippets.

View AmitDJagtap's full-sized avatar
💭
code on

AmitDJagtap

💭
code on
View GitHub Profile
>> db.findOne(id : xyz, Person).then((data) => {
// data = Hydrate(data);
data.name = 'new name';
data.title = 'Mrs';
db.save(data, Person).then((result) => {
resolve(result);
});
});
>> db.updateFields(Person, { query: { id: data.id }, fields: { $set: { name: 'new Name', title: 'Mrs' } } }
executionStats: {
"executionSuccess": true,
"nReturned": 3,
"executionTimeMillis": 0,
"totalKeysExamined": 3,
"totalDocsExamined": 3,
"executionStages": {}
}
{
_id: 1,
item: "abc",
stock: [
{ size: "S", color: "red", quantity: 25
},
{ size: "S", color: "blue", quantity: 10
},
{ size: "M", color: "blue", quantity: 50
}
db.reviews.createIndex(
{
subject: "text",
comments: "text"
}
)
exports.handler = async(event) => {
var Slack = require('slack-node');
var slack = new Slack();
var webhookUri = process.env.SLACK_HOOK ? process.env.SLACK_HOOK : "https://hooks.slack.com/services/your/slack/hook";
slack.setWebhook(webhookUri);
console.log(event.region);
console.log(event.detail.severity);
console.log(event.detail.service.additionalInfo);
{
"version": "0",
"id": "c8c4daa7-a20c-2f03-0070-b7393dd542ad",
"detail-type": "GuardDuty Finding",
"source": "aws.guardduty",
"account": "123456789012",
"time": "1970-01-01T00:00:00Z",
"region": "us-east-1",
"resources": [],
"detail": {
{
"name": "guardutyalert",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "damitj",
"license": "ISC",