

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- 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
- Regular expression “[X?+] ” Metacharacter Java
- Difference between “now” and a given date with MongoDB?
- Absolute difference between the first X and last X Digits of N?
- Difference between %p and %x in C/C++
- How to deal with error “var(x) : Calling var(x) on a factor x is defunct.” in R?
- Difference between “int main()” and “int main(void)” in C/C++?
- Differences between Python 2.x and Python 3.x?
- What is the difference between “lang” and “type” attributes in a script tag?
- How to make a jQuery function call after “X” seconds?
- Difference between application/x-javascript and text/javascript content types?
Advertisements