Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
