Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

mongodb check if collection exists

db.collectionNames(collName, function(err, names) {
    console.log('Exists: ', names.length > 0);
});

// MongoDB 2.x:
db.listCollections({name: collName})
    .next(function(err, collinfo) {
        if (collinfo) {
            // The collection exists
        }
    });
Comment

PREVIOUS NEXT
Code Example
Javascript :: discord.js ban user 
Javascript :: express.js hello world 
Javascript :: constructor function 
Javascript :: reactjs framer motion 
Javascript :: javascript add dom disabled 
Javascript :: animate javascript 
Javascript :: dropzone react view photo 
Javascript :: delete an element to an array 
Javascript :: embedded javascript 
Javascript :: disable URL encoder javascript 
Javascript :: jquery get fail 
Javascript :: jquery timer countdown 
Javascript :: alert function in javascript 
Javascript :: javascript add update query parameter to url 
Javascript :: change react native app name 
Javascript :: expo modal 
Javascript :: simple id using javascrip math randomt 
Javascript :: javascript check if variable is empty 
Javascript :: js import export 
Javascript :: enzynme not support react 17 
Javascript :: how to add multiple elements to A new array javascript 
Javascript :: javascript comments 
Javascript :: { use UnifiedTopology: true } 
Javascript :: for in js 
Javascript :: prevent onclick event javascript 
Javascript :: jquery for element which doesnt exist on page load 
Javascript :: dummy data json 
Javascript :: legend on click use default chartjs 
Javascript :: join two arrays in js 
Javascript :: mongoose update 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =