Skip to main content

Posts

Showing posts with the label MongoDB

MongoDB - Create Database

MongoDB - Create Database If you want to check your databases list, use the command show dbs Your created database (mydb) is not present in list. To display database, you need to insert at least one document into it. MongoDB use DATABASE_NAME is used to create a database. > use database_name

MongoDB - Create Collection

MongoDB - Create Collection MongoDB db.createCollection(name, options) is used to create collection. Syntax Basic syntax of createCollection() command is as follows − db.createCollection(name, options) In the command, name is name of collection to be created. Options is a document and is used to specify configuration of collection. Parameter Type Description Name String Name of the collection to be created Options Document (Optional) Specify options about memory size and indexing Options parameter is optional, so you need to specify only the name of the collection. Following is the list of options you can use − Field Type Description capped Boolean (Optional) If true, enables a capped collection. Capped collection is a fixed size collection that automatically overwrites its oldest entries when it reaches its maximum size. If you specify true, you need to specify size parameter also. autoIndexId Boolean (Optional) If true, automatically create index on _id field.s Default value i

MongoDB: Data Types

MongoDB Data Types   : MongoDB stores documents on disk in the BSON serialization format. BSON is a binary representation of JSON documents, though BSON data format provides more data types than JSON.

MongoDB Introduction

MongoDB is an Open Source database written in C++. It can be used to store data for very high-performance applications (for example Foursquare is using it in production).