- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
Which characters are NOT allowed in MongoDB field names?
Do not use $ symbol or period (.) because these characters are not allowed for MongoDB field names. The field shouldn’t start with $.
Here is an example of the allowed characters −
> db.charactersAllowedDemo.insertOne({"Employee Name" : "John"}); { "acknowledged" : true, "insertedId" : ObjectId("5c7fefbc8d10a061296a3c6d") }
Display all documents from a collection with the help of find() method. The query is as follows −
> db.charactersAllowedDemo.find().pretty();
The following is the output −
{ "_id" : ObjectId("5c7fefbc8d10a061296a3c6d"), "Employee Name" : "John" }
Advertisements