Set operations
MongoDB concept equivalent to the set of SQL table concept.
- Create Collection
db.createCollextion()
- When you insert a document to a collection, if the collection does not exist, it is automatically created
db.collection_name.insert()
- A set of naming conventions
- It can not be an empty string
- Not contain '\ 0'
- Not start with a system, which is reserved prefix collection system
- Do the same name and a set of reserved words do not include $
- View the collection database
show tables
orshow collections
- Delete Collection
db.collection_name.drop()
- Modify the collection name
db.collection_name.renameCollection('newName')
- eg class1 will be renamed class0
db.class1.renameCollection('class0')
- eg class1 will be renamed class0
- Gets a collection of objects
db.collection_name
db.getCollection('collection_name')