- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Can we use the “.” symbol in MongoDB collection name?
Yes, we can use the “.” symbol in MongoDB collection name. Let us create a collection with documents −
> db.getCollection('demo28.example'); web.demo28.example > > > db.getCollection('demo28.example').insertOne({"Name":"Chris","Age":32}); { "acknowledged" : true, "insertedId" : ObjectId("5e15fbe48f2315c2efc48e6b") } > db.getCollection('demo28.example').insertOne({"Name":"Bob","Age":31}); { "acknowledged" : true, "insertedId" : ObjectId("5e15fbec8f2315c2efc48e6c") } > db.getCollection('demo28.example').insertOne({"Name":"David","Age":33}); { "acknowledged" : true, "insertedId" : ObjectId("5e15fbf38f2315c2efc48e6d") }
Display all documents from a collection with the help of find() method −
> db.getCollection('demo28.example').find().pretty();
This will produce the following output −
{ "_id" : ObjectId("5e15fbe48f2315c2efc48e6b"), "Name" : "Chris", "Age" : 32 } { "_id" : ObjectId("5e15fbec8f2315c2efc48e6c"), "Name" : "Bob", "Age" : 31 } { "_id" : ObjectId("5e15fbf38f2315c2efc48e6d"), "Name" : "David", "Age" : 33 }
- Related Articles
- Change collection name in MongoDB?
- How can I drop a collection in MongoDB with two dashes in the name?
- Renaming column name in a MongoDB collection?
- Can we use NOT and AND together in MongoDB?
- Find the MongoDB collection size for name “Chris”
- Variable collection name in MongoDB shell with JavaScript?
- Can we use “rank” as column name with MySQL8?
- How can I rename a collection in MongoDB?
- Is it possible to use MongoDB capped collection?
- Why can't we use column name “desc” in MySQL?
- Can we use “When” as column name in CREATE TABLE statement?
- Can we use reserved word ‘index’ as MySQL column name?
- Can we use MySQL keyword as alias name for a column?
- Why we use Element Symbol in science? Are element symbols are important when we right reactions?
- How can I change the field name in MongoDB?

Advertisements