
- MongoDB Tutorial
- MongoDB - Home
- MongoDB - Overview
- MongoDB - Advantages
- MongoDB - Environment
- MongoDB - Data Modeling
- MongoDB - Create Database
- MongoDB - Drop Database
- MongoDB - Create Collection
- MongoDB - Drop Collection
- MongoDB - Data Types
- MongoDB - Insert Document
- MongoDB - Query Document
- MongoDB - Update Document
- MongoDB - Delete Document
- MongoDB - Projection
- MongoDB - Limiting Records
- MongoDB - Sorting Records
- MongoDB - Indexing
- MongoDB - Aggregation
- MongoDB - Replication
- MongoDB - Sharding
- MongoDB - Create Backup
- MongoDB - Deployment
- MongoDB - Java
- MongoDB - PHP
- Advanced MongoDB
- MongoDB - Relationships
- MongoDB - Database References
- MongoDB - Covered Queries
- MongoDB - Analyzing Queries
- MongoDB - Atomic Operations
- MongoDB - Advanced Indexing
- MongoDB - Indexing Limitations
- MongoDB - ObjectId
- MongoDB - Map Reduce
- MongoDB - Text Search
- MongoDB - Regular Expression
- Working with Rockmongo
- MongoDB - GridFS
- MongoDB - Capped Collections
- Auto-Increment Sequence
- MongoDB Useful Resources
- MongoDB - Questions and Answers
- MongoDB - Quick Guide
- MongoDB - Useful Resources
- MongoDB - Discussion
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) }
- Related Articles
- How to search documents through an integer array in MongoDB?
- Inserting Date() in MongoDB through Mongo shell?
- How to insert an element into all positions in an array using recursion - JavaScript?
- How to insert a document into a MongoDB collection using Java?
- How to insert multiple document into a MongoDB collection using Java?
- How do I convert a string into an integer in JavaScript?
- Insert data into inner array in MongoDB?
- How to convert a string into integer in JavaScript?
- How to insert new documents into a MongoDB collection in your database?
- How to insert an element into DOM using jQuery?
- How to convert a string into an integer without using parseInt() function in JavaScript?
- How to change Entry.get() into an integer in Tkinter?
- Variable collection name in MongoDB shell with JavaScript?
- How to divide an unknown integer into a given number of even parts using JavaScript?
- How to terminate a MongoDB shell script earlier?

Advertisements