![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
How to insert an 8-byte integer into MongoDB through JavaScript shell?
You can use below syntax for inserting an 8-byte integer in MongoDB through JavaScript shell −
anyVariableName= {"yourFieldName" : new NumberLong("yourValue")};
To display the above variable, you can use the variable name or printjson(). Following is the query to insert 8 byte integer in MongoDB −
> userDetail = {"userId" : new NumberLong("98686869")}; { "userId" : NumberLong(98686869) }
Let us display the above variable value using variable name. The query is as follows −
> userDetail
This will produce the following output −
{ "userId" : NumberLong(98686869) }
Let us display the variable value using printjson() −
> printjson(userDetail);
This will produce the following output −
{ "userId" : NumberLong(98686869) }
Advertisements