MongoDB: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
			
		
		
	
 (Created page with "== Overview == MongoDB 내용 정리.  == Errors == === db.collection is not a function === In mongodb version >= 3.0, that database variable is actually the parent object of...")  | 
			
(No difference) 
 | 
Latest revision as of 14:57, 6 January 2018
Overview
MongoDB 내용 정리.
Errors
db.collection is not a function
In mongodb version >= 3.0, that database variable is actually the parent object of the object it trying to access with database.collection('whatever').
To access the correct object, it need to reference its database name. <source lang=javascript> MongoClient.connect(db.url,(err,database) =>{
 const myAwesomeDB = database.db('myDatabaseNameAsAString')
 myAwesomeDB.collection('theCollectionIwantToAccess')
} </source>