- 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
Convert NumberLong to String in MongoDB?
In order to convert NumberLong to String in MongoDB, you can use toString() −
NumberLong('yourValue').valueOf().toString();
To convert NumberLong to String, you can use valueOf() as well −
NumberLong('yourValue').valueOf();
Let us implement both the above syntaxes.
Following is the query to convert NumberLong to String with toString() −
> NumberLong('1000').valueOf().toString();
This will produce the following output −
1000
Following is the query to convert NumberLong to Number with valueOf()
> NumberLong('1000').valueOf();
This will produce the following output −
1000
Advertisements