- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Difference between NumberLong(x) and NumberLong(“x”) in MongoDB?
The NumberLong(x) goes beyond its limit value and round off the value whereas NumberLong(“x”) does not.
Now, we will consider a number and would use it for both NumberLong(x) and NumberLong(“x”) to see the difference.
Let us create a collection with documents −
> db.demo603.insert({"longValue" : NumberLong(988998985857575789)}); WriteResult({ "nInserted" : 1 }) > db.demo603.insert({"longValueInString" : NumberLong("988998985857575789")});
Display all documents from a collection with the help of find() method −
> db.demo603.find().pretty();
This will produce the following output −
{ "_id" : ObjectId("5e9605e5ed011c280a0905d1"), "longValue" : NumberLong("988998985857575808") } { "_id" : ObjectId("5e9605faed011c280a0905d2"), "longValueInString" : NumberLong("988998985857575789") }
- Related Articles
- Convert NumberLong to String in MongoDB?
- Find and replace NumberLong type field in MongoDB?
- How to print NumberLong value in MongoDB?
- Difference between x++ and x = x+1 in Java
- Difference between x++ and x= x+1 in Java programming
- Difference between %p and %x in C/C++
- Absolute difference between the first X and last X Digits of N?
- Difference between application/x-javascript and text/javascript content types?
- Difference between MySQL and MongoDB
- Difference between RDBMS and MongoDB
- Difference between Hadoop and MongoDB
- Differences between Python 2.x and Python 3.x?
- Insert five rational numbers between $x$ and $|x|$, where $x=frac{-17}{20}$.
- The angles of a triangle are ( x, y ) and ( 40^{circ} ). The difference between the two angles ( x ) and ( y ) is ( 30^{circ} ). Find ( x ) and ( y ).
- Difference between count() and find().count() in MongoDB?

Advertisements