Creating users in MongoDB is as simple as running the following commands: use db_name; db.createUser({ user: “user_name”, pwd: “password”, roles: [ “readWrite”, “dbAdmin” ] }) Here: db_name : Database Name user_name: Username of the user password: Password of the user roles: Roles of the user – Is an array and can be empty Eg. readWrite, dbAdmin, clusterAdmin, […]
Category: Web
Facebook’s video auto-play settings can be turned on or off. This will help you save bandwidth and help remove the distraction of an autoplaying video. To stop videos from playing automatically do the following: Go to your facebook timeline. From the top right of Facebook, click the option and select Settings Click Videos in the […]
JQuery: Join JSON arrays
The simplest way to merge JSON arrays usning JQuery is to use the concat function. var json1 = [{id: 1, name: “one”}]; var json2 = [{id: 2, name: “two”}, {id: 3, name: “three”}]; var finalObj = json1.concat(json2); Here finalObj will contain an array of 3 objects: [{id: 1, name: “one”},{id: 2, name: “two”}, {id: 3, […]
JQuery Check if Element Exists using this simple piece of code. To check this in the current page, we need to check the length of the element returned by the JQuery selector, if it returns you something then the element must exists otherwise no. if( $(‘#EleSelector’).length ) { // use this if you are using […]
For a check box with the id “checkbox”, here is how to check if its checked: $(‘#checkbox’).is(‘:checked’); // Returns True if checked else False