Skip to content

Instantly share code, notes, and snippets.

@darshanan24
darshanan24 / event_model.js
Created September 7, 2018 07:59
If i donot post any array values when i am creating document collection, it should throw an error. like path to "columns" is required. bUt its not giving any error as such(only happening for array).
const mongoose = require('mongoose');
const EventTypes = ['Raw', 'Enriched', 'Joined']
const EventFormats = ["JSON", "DELIMITED", "FIXEDWIDTH", "REGEX"]
const ColumnDataTypes = ["int", "float", "Double", "string"]
const ColumnTypes = ["Description", "ID", "Time"]
var notEmpty = function(columns){
if(columns.length === 0){console.log("not empty");return false}
else {console.log("true not empty");return true};
@darshanan24
darshanan24 / .txt
Last active November 24, 2018 15:28
Common interview questions
1. given a string calculate the number of repeated words and return a value.
var fruits = "orange banana orange mango"
function sting(str){
var n = str.match(/orange/g);
console.log(n.length)
}
sting(fruits)