SlideShare ist ein Scribd-Unternehmen logo
1 von 28
MongoDB (Advanced)
ByAmitKumar
Agenda
1. MongoDB beginnerrecap
2. What isdb ??
3. Wrapped Queries
4. Query usingModifiers
5. Upsert (SaveOrUpdate Query)
6. Updating MultipleDocuments
7. Specifying Which Keys toReturn
8. AND/OR Queries
9. Querying on Embedded Documents
10. Cursors
11. Geospatial Indexing
MongoDB beginner recap
1. A JSON object iscalled A Document. (Row in MySQL)
2. Group of documents are called Collection. (Table in MySQL)
3. To install MongoDB: sudo apt-get installmongodb;
4. Tostart MongoDB: mongo;
5. To show database names:showdbs;
6. To select Database: usedbName;
7. Toget All Collections: show collections; OR show tables;
//Every document stored in MongoDB must have an "_id"key
8. To insert A Document: db.collectionName.insert(document);
9. Toget matching up to 20 Documents:
db.collectionName.find();
MongoDB beginner recap ...
10.To get first document:db.collectionName.findOne();
11. To drop Collection:db.collectionName.drop();
12. To drop Database:db.dropDatabase();
13.Toremove All Documents from A Collection:
db.collectionName.remove();
14. To update Document: db.collectionName.update(document1,
document2);
// it takes (at least) two parameters: the firstisthe criteria to
find which document to update. And second is the new
document.
15.Documents can contain entire documents, embedded as
values in a parent document, eg.
{"x": {"foo":"bar"}}
What is db??
On startup, the shell connects to the test database on a
MongoDB server and assigns thisdatabase connection
to the global variable db.
Ifwe look at the db variable, we can see that it refers to the
testdatabase.
>db
test
Store JavaScript
1. MongoDB comes with a JavaScript shell that allows interaction with a
MongoDB instance from the command line
2.We can store and use JavaScript functions and values on the server side
Wrapped Queries
1. LikeQuery
db.Tag.find( {name:/^term/});
2. SortQuery
1 for ascending sort
-1for descending sort
db.Tag.find().sort( {userName:-1, age:1});
3. LimitQuery
db.Tag.find().limit(10);
Wrapped Queries ...
4. CountQuery
db.Tag.find().count();
5. SkipQuery
db.Tag.find().skip(50);
NOTE:A good way of figuring out what a function isdoing isto
type it without the parentheses. This will print the
JavaScript source code for the function.
Query using Modifiers
1. NotEqualModifier($ne)
db.Tag.find({firstProperty :{$ne :3}});
2. Greater/LessthanModifier($gt,$lt,$gte,$lte)
db.Tag.find({firstProperty :{$gt :2}});
db.Tag.find({firstProperty :{$lt :2}});
db.Tag.find({firstProperty :{$gte :2}});
db.Tag.find({firstProperty :{$lte :2}});
Query using Modifiers ...
3. IncrementModifier($inc)
db.Tag.update( {thirdProperty:"Helo19"},
{"$inc": {firstProperty:2}})
4. SetModifire($set)
db.Tag.update( {thirdProperty:"Helo19"},
{"$set":{fourthProperty: "newValue"}})
NOTE:Key-value will be created if the key doesn't existsyet in the case of both
$set and $inc. $inc works for integers only. $set works for all. $inc Incrementing
isextremely fast, so any performance penaltyisnegligible.
Query using Modifiers ...
5. UnsetModifier($unset)
db.Tag.update( {thirdProperty:"Helo19"},
{"$unset": {fourthProperty: "anything"}})
6. PushModifire($push)
db.Blog.update( {title:"1st Blog"},{$push:
{comment:"1st Comment"}});
NOTE:"$push" adds an element to the end of an array if the
specified key already existsand creates a new array if it
does not.
Query using Modifiers ...
7. AddToSetModifier($addToSet)
db.Blog.update( {title:"1st Blog"},{$addToSet:
{comment:"2nd Comment"} });
8.PopModifier($pop)
comment =-1remove an element from start.
comment =1 remove an element fromend
db.Blog.update( {title:"1stBlog"},{$pop:{comment:-1} });
Query using Modifiers ...
9. Pul Modifier($pull)
db.Blog.update({title:"1st Blog"},{$pul:{comment:"2st Comment"}})
NOTE:Pulling removes all matching documents, not justa single
match.
10.PositionOperator($)The positional operator updates only
the firstmatch.
db.embededDocument.update({"comments.author" :"John"},
{"$inc" :{"comments.0.votes":1}})
db.embededDocument.update({"comments.votes" :3},
{"$set": {"comments.$.author" : "AmitKumar"}})
Upsert(SaveOrUpdate Query)
An upsert isa special type of update.
1. Ifno document isfound that matches the update criteria, a new document
will be created by combining the criteria and update documents.
2. Ifa matching document isfound, it will be updated normally.
db.Tag.update(document1, document2, true);
db.Tag.update({secondProperty:”Jav”}, {"$inc":{"firstProperty":100}},true)
db.Tag.save(document)
Note: save works onId only.
Updating Multiple Documents
Updates, by default, update only the first document found that
matches the criteria. Ifthere are more matching documents, they
will remain unchanged. Tomodify all of the documents matching
the criteria, you can pass true as the fourth parameter to update.
db.Tag.update(document1, document2, false, true);
db.Tag.update({secondProperty:/J/}, {"$inc":{"firstProperty":100}},false, true)
Specifying Which Keys to Return
Sometimes, you do not need all of the key/value pairs in a
document returned. If this is the case, you can pass a second
argument to find (or findOne) specifying the keys you want. This
reduces both the amount of data sent over the wire and the time
and memory used to decode documents on the client side.
db.Tag.find({}, {_id:0,firstProperty:1})
OR Queries
There are two ways to do an OR query.
1."$in"can be used to query for a variety of values for a single key.
db.Blog.find( {comment: {$in:["5thComment", "1stComment"]} })
2."$or"ismore general; it can be used to query for any
of the given values across multiple keys.
db.Tag.find( {$or:[{firstProperty:0},{secondProperty:/J/} ]})
NOTE:The opposite of "$in"is"$nin".
AND Queries
There are two ways to do an AND query.
1."$al" can be used to query for a variety of values for a single key.
db.Blog.find( {comment:{$al:["5th Comment", "1stComment"]} })
NOTE: Below will do exact match and order too matters, if order will change
then it will notmatch.
db.Blog({"comment" : ["5thComment", "comment1stComment"]})
AND Queries ...
2.Simple queries are and queries. Itcan be used to query for any
of the given values across single/multiple keys.
db.Tag.find( {firstProperty:0, secondProperty:/J/} )
db.Blog.find({comment:"5th Comment",comment:"1st Comment"})
Querying on Embedded Document
There are two ways of querying for an embedded document.
1.Querying for an entire embedded document works identically to a normal
query.
db.User.find( {name: {first:"Amit",last:"Kumar"}})
Thisquery will do exact match and order too matters, if order will change then
it will not find.
2.Querying for its individual key/value pairs.
db.User.find({"name.first" : "Amit","name.last" :"Kumar"})
Cursors
The database returns results from find using a cursor. If we do not store the
resultsin a variable, the MongoDB shell will automatically iterate through
and display the first couple of documents. When you call find, the shell
does not query the database immediately. Itwaits until you actually start
requesting resultsto send the query, which allows you to chain additional
options onto a query before it is performed. Almost every method on a
cursor object returns the cursor itself so that you can chain them in any
order. For instance, all of the following are equivalent
>var cursor =db.Tag.find().sort({"x":1}).limit(1).skip(10);
>var cursor =db.Tag.find().limit(1).sort({"x":1}).skip(10);
>var cursor =db.Tag.find().skip(10).limit(1).sort({"x":1});
Indexing
Indexes are the way to make queries go vroom. Suppose that you are
querying for a single key, such as the following:
db.User.find({"username":"mark"})
When only a single key is used in the query, that key can be indexed to
improve the query’s speed. In this case, you would create an index on
"username". Tocreate the index, use the ensureIndex method:
db.User.ensureIndex({"username":1})
Geospatial Indexing
There is another type of query that is becoming increasingly common
(especially with the emergence of mobile devices): finding the nearest N
things to acurrent location.
1. MongoDB provides a special type of index for coordinate plane queries,
called a geospatialindex.
2. A geospatial index can be created using the ensureIndex function, but by
passing "2d" as a value instead of 1 or -1:
db.User.ensureIndex({"location" :"2d"})
Geospatial Indexing ...
The "location" key must be some type of pair value, that is, a two-element
array or embedded document with two keys.The keys can be anything:
{"location" : [0,100]}
{"location" : {"x":-30,"y": 30 }}
{"location" :{"latitude" : -180,"longitude" :180 } }
{"location" : {"foo": 0,"bar" :1}}
Geospatial Indexing ...
Geospatial queries can be performed in two ways:
1. As a normal query (using find): The find approach issimilarto performing a
nongeospatial query, except the conditional "$near" is used. It takes an
array of the two target values:
db.User.find({"location" : {"$near": [40,-73]}})
2. GeoNear command: ”geoNear” also returns the distance of each result
document from the querypoint.
db.runCommand({geoNear : "User",near : [40,-73],num :10});
Contact us
Here’s how TOTHENEW
uses MongoDB to create a
rich experience for your
customers!
Click Here To Know More!
Have more queries
related to MongoDB?
Talk To Our Experts!
Our Office
Client
Location
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Indexing & Query Optimization
Indexing & Query OptimizationIndexing & Query Optimization
Indexing & Query OptimizationMongoDB
 
Fast querying indexing for performance (4)
Fast querying   indexing for performance (4)Fast querying   indexing for performance (4)
Fast querying indexing for performance (4)MongoDB
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexingMahabubur Rahaman
 
Webinar: PostgreSQL continuous backup and PITR with Barman
Webinar: PostgreSQL continuous backup and PITR with BarmanWebinar: PostgreSQL continuous backup and PITR with Barman
Webinar: PostgreSQL continuous backup and PITR with BarmanGabriele Bartolini
 
Microsoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxMicrosoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxsamtakke1
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMSPadamNepal1
 
Introduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operationsIntroduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operationsAnand Kumar
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation FrameworkCaserta
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Javaparag
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREESKathirvel Ayyaswamy
 
PL/SQL Fundamentals I
PL/SQL Fundamentals IPL/SQL Fundamentals I
PL/SQL Fundamentals INick Buytaert
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)Uwe Printz
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQLJoel Brewer
 

Was ist angesagt? (20)

SQL
SQLSQL
SQL
 
Indexing & Query Optimization
Indexing & Query OptimizationIndexing & Query Optimization
Indexing & Query Optimization
 
Fast querying indexing for performance (4)
Fast querying   indexing for performance (4)Fast querying   indexing for performance (4)
Fast querying indexing for performance (4)
 
View & index in SQL
View & index in SQLView & index in SQL
View & index in SQL
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexing
 
Webinar: PostgreSQL continuous backup and PITR with Barman
Webinar: PostgreSQL continuous backup and PITR with BarmanWebinar: PostgreSQL continuous backup and PITR with Barman
Webinar: PostgreSQL continuous backup and PITR with Barman
 
Microsoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxMicrosoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptx
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
Introduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operationsIntroduction to MongoDB and CRUD operations
Introduction to MongoDB and CRUD operations
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREES
 
DML Commands
DML CommandsDML Commands
DML Commands
 
PL/SQL Fundamentals I
PL/SQL Fundamentals IPL/SQL Fundamentals I
PL/SQL Fundamentals I
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
SQL
SQLSQL
SQL
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)MongoDB for Coder Training (Coding Serbia 2013)
MongoDB for Coder Training (Coding Serbia 2013)
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQL
 

Andere mochten auch

FUKUYAMA BASE WORKSHOP Vol15 Theme
FUKUYAMA BASE WORKSHOP Vol15 ThemeFUKUYAMA BASE WORKSHOP Vol15 Theme
FUKUYAMA BASE WORKSHOP Vol15 Themenoteproject
 
3 Montages of different live performances
3 Montages of different live performances3 Montages of different live performances
3 Montages of different live performancessathma
 
Analyzing data
Analyzing dataAnalyzing data
Analyzing datasathma
 
Unicef
UnicefUnicef
Unicefmerve
 
What do you if you are going to miss a deadline
What do you if you are going to miss a deadlineWhat do you if you are going to miss a deadline
What do you if you are going to miss a deadlineSecurimate, Inc.
 
Microcurriculo
MicrocurriculoMicrocurriculo
MicrocurriculoComfama
 
Jak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasem
Jak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasemJak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasem
Jak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasemMarta Dzienkiewicz
 
Annotating images-animation
Annotating images-animationAnnotating images-animation
Annotating images-animationsathma
 
Comida
ComidaComida
ComidaLauren
 
Silverpop Connect Dubai - Opening Keynote
Silverpop Connect Dubai - Opening KeynoteSilverpop Connect Dubai - Opening Keynote
Silverpop Connect Dubai - Opening KeynoteJohn Watton
 
Four montages
Four montagesFour montages
Four montagessathma
 
Four montages
Four montagesFour montages
Four montagessathma
 
Production schedule 2011
Production schedule 2011Production schedule 2011
Production schedule 2011sathma
 
統一發票真偉大─林 蘭
統一發票真偉大─林   蘭統一發票真偉大─林   蘭
統一發票真偉大─林 蘭linda lin
 
C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1picardo123
 
FUKUYAMA BASE Workshop Vol.10 Theme
FUKUYAMA BASE Workshop Vol.10 ThemeFUKUYAMA BASE Workshop Vol.10 Theme
FUKUYAMA BASE Workshop Vol.10 Themenoteproject
 
1000 tetti fotovoltaici bando allegati
1000 tetti fotovoltaici bando allegati1000 tetti fotovoltaici bando allegati
1000 tetti fotovoltaici bando allegatiIl Lavoro Solidale
 

Andere mochten auch (20)

FUKUYAMA BASE WORKSHOP Vol15 Theme
FUKUYAMA BASE WORKSHOP Vol15 ThemeFUKUYAMA BASE WORKSHOP Vol15 Theme
FUKUYAMA BASE WORKSHOP Vol15 Theme
 
3 Montages of different live performances
3 Montages of different live performances3 Montages of different live performances
3 Montages of different live performances
 
Analyzing data
Analyzing dataAnalyzing data
Analyzing data
 
Unicef
UnicefUnicef
Unicef
 
What do you if you are going to miss a deadline
What do you if you are going to miss a deadlineWhat do you if you are going to miss a deadline
What do you if you are going to miss a deadline
 
Microcurriculo
MicrocurriculoMicrocurriculo
Microcurriculo
 
Jak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasem
Jak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasemJak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasem
Jak być na bieżąco czyli aplikacje i narzędzia do zarządzania czasem
 
Annotating images-animation
Annotating images-animationAnnotating images-animation
Annotating images-animation
 
Comida
ComidaComida
Comida
 
Silverpop Connect Dubai - Opening Keynote
Silverpop Connect Dubai - Opening KeynoteSilverpop Connect Dubai - Opening Keynote
Silverpop Connect Dubai - Opening Keynote
 
Four montages
Four montagesFour montages
Four montages
 
Four montages
Four montagesFour montages
Four montages
 
Production schedule 2011
Production schedule 2011Production schedule 2011
Production schedule 2011
 
統一發票真偉大─林 蘭
統一發票真偉大─林   蘭統一發票真偉大─林   蘭
統一發票真偉大─林 蘭
 
C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1C:\Fakepath\Nucleotide A H1 N1
C:\Fakepath\Nucleotide A H1 N1
 
Cumc pres
Cumc presCumc pres
Cumc pres
 
FUKUYAMA BASE Workshop Vol.10 Theme
FUKUYAMA BASE Workshop Vol.10 ThemeFUKUYAMA BASE Workshop Vol.10 Theme
FUKUYAMA BASE Workshop Vol.10 Theme
 
Ana
AnaAna
Ana
 
Ppt qa 2
Ppt qa 2Ppt qa 2
Ppt qa 2
 
1000 tetti fotovoltaici bando allegati
1000 tetti fotovoltaici bando allegati1000 tetti fotovoltaici bando allegati
1000 tetti fotovoltaici bando allegati
 

Ähnlich wie MongoDB (Advanced)

Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo dbDaeMyung Kang
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMetatagg Solutions
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling rogerbodamer
 
A Year With MongoDB: The Tips
A Year With MongoDB: The TipsA Year With MongoDB: The Tips
A Year With MongoDB: The TipsRizky Abdilah
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data ModelingDATAVERSITY
 
What do you mean, Backwards Compatibility?
What do you mean, Backwards Compatibility?What do you mean, Backwards Compatibility?
What do you mean, Backwards Compatibility?Trisha Gee
 
Schema design short
Schema design shortSchema design short
Schema design shortMongoDB
 
Indexing & query optimization
Indexing & query optimizationIndexing & query optimization
Indexing & query optimizationJared Rosoff
 
Mongo db basic installation
Mongo db basic installationMongo db basic installation
Mongo db basic installationKishor Parkhe
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - GuilinJackson Tian
 
Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)MongoDB
 
Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04Krishna Sankar
 
Indexing documents
Indexing documentsIndexing documents
Indexing documentsMongoDB
 
Indexing and Query Optimizer
Indexing and Query OptimizerIndexing and Query Optimizer
Indexing and Query OptimizerMongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBAlex Bilbie
 
Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27MongoDB
 

Ähnlich wie MongoDB (Advanced) (20)

Superficial mongo db
Superficial mongo dbSuperficial mongo db
Superficial mongo db
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg Solutions
 
Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling Intro to MongoDB and datamodeling
Intro to MongoDB and datamodeling
 
A Year With MongoDB: The Tips
A Year With MongoDB: The TipsA Year With MongoDB: The Tips
A Year With MongoDB: The Tips
 
Latinoware
LatinowareLatinoware
Latinoware
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling
 
What do you mean, Backwards Compatibility?
What do you mean, Backwards Compatibility?What do you mean, Backwards Compatibility?
What do you mean, Backwards Compatibility?
 
Schema design short
Schema design shortSchema design short
Schema design short
 
Indexing & query optimization
Indexing & query optimizationIndexing & query optimization
Indexing & query optimization
 
Mongo db basic installation
Mongo db basic installationMongo db basic installation
Mongo db basic installation
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Mongoskin - Guilin
Mongoskin - GuilinMongoskin - Guilin
Mongoskin - Guilin
 
Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer (Mongo Austin)
 
Nosql hands on handout 04
Nosql hands on handout 04Nosql hands on handout 04
Nosql hands on handout 04
 
Indexing documents
Indexing documentsIndexing documents
Indexing documents
 
Indexing and Query Optimizer
Indexing and Query OptimizerIndexing and Query Optimizer
Indexing and Query Optimizer
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27
 

Mehr von TO THE NEW | Technology

10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!TO THE NEW | Technology
 
10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:TO THE NEW | Technology
 
12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective CTO THE NEW | Technology
 
An introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptAn introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptTO THE NEW | Technology
 
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape SoftwareTO THE NEW | Technology
 
MongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlMongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlTO THE NEW | Technology
 
BigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchBigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchTO THE NEW | Technology
 

Mehr von TO THE NEW | Technology (20)

10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!10 Best Node.js Practices you Need to Know!
10 Best Node.js Practices you Need to Know!
 
10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:10 Pragmatic UX techniques for building smarter products:
10 Pragmatic UX techniques for building smarter products:
 
12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C12 Key points which make Swift more effective than Objective C
12 Key points which make Swift more effective than Objective C
 
Gulp - The Streaming Build System
Gulp - The Streaming Build SystemGulp - The Streaming Build System
Gulp - The Streaming Build System
 
Grails Spring Boot
Grails Spring BootGrails Spring Boot
Grails Spring Boot
 
AWS Elastic Beanstalk
AWS Elastic BeanstalkAWS Elastic Beanstalk
AWS Elastic Beanstalk
 
Content migration to AEM
Content migration to AEMContent migration to AEM
Content migration to AEM
 
AWS CodeDeploy
AWS CodeDeployAWS CodeDeploy
AWS CodeDeploy
 
Big Data Expertise
Big Data ExpertiseBig Data Expertise
Big Data Expertise
 
An introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScriptAn introduction to Object Oriented JavaScript
An introduction to Object Oriented JavaScript
 
Object Oriented JavaScript - II
Object Oriented JavaScript - IIObject Oriented JavaScript - II
Object Oriented JavaScript - II
 
MongoDb and NoSQL
MongoDb and NoSQLMongoDb and NoSQL
MongoDb and NoSQL
 
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
(AWS) Auto Scaling : Evening Session by Amazon and IntelliGrape Software
 
MongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behlMongoDB using Grails plugin by puneet behl
MongoDB using Grails plugin by puneet behl
 
Cloud Formation
Cloud FormationCloud Formation
Cloud Formation
 
BigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearchBigData Search Simplified with ElasticSearch
BigData Search Simplified with ElasticSearch
 
JULY IN GRAILS
JULY IN GRAILSJULY IN GRAILS
JULY IN GRAILS
 
Grails Spock Testing
Grails Spock TestingGrails Spock Testing
Grails Spock Testing
 
Getting groovier-with-vertx
Getting groovier-with-vertxGetting groovier-with-vertx
Getting groovier-with-vertx
 
Introduction to Kanban
Introduction to KanbanIntroduction to Kanban
Introduction to Kanban
 

Kürzlich hochgeladen

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Kürzlich hochgeladen (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

MongoDB (Advanced)

  • 1.
  • 3. Agenda 1. MongoDB beginnerrecap 2. What isdb ?? 3. Wrapped Queries 4. Query usingModifiers 5. Upsert (SaveOrUpdate Query) 6. Updating MultipleDocuments 7. Specifying Which Keys toReturn 8. AND/OR Queries 9. Querying on Embedded Documents 10. Cursors 11. Geospatial Indexing
  • 4. MongoDB beginner recap 1. A JSON object iscalled A Document. (Row in MySQL) 2. Group of documents are called Collection. (Table in MySQL) 3. To install MongoDB: sudo apt-get installmongodb; 4. Tostart MongoDB: mongo; 5. To show database names:showdbs; 6. To select Database: usedbName; 7. Toget All Collections: show collections; OR show tables; //Every document stored in MongoDB must have an "_id"key 8. To insert A Document: db.collectionName.insert(document); 9. Toget matching up to 20 Documents: db.collectionName.find();
  • 5. MongoDB beginner recap ... 10.To get first document:db.collectionName.findOne(); 11. To drop Collection:db.collectionName.drop(); 12. To drop Database:db.dropDatabase(); 13.Toremove All Documents from A Collection: db.collectionName.remove(); 14. To update Document: db.collectionName.update(document1, document2); // it takes (at least) two parameters: the firstisthe criteria to find which document to update. And second is the new document. 15.Documents can contain entire documents, embedded as values in a parent document, eg. {"x": {"foo":"bar"}}
  • 6. What is db?? On startup, the shell connects to the test database on a MongoDB server and assigns thisdatabase connection to the global variable db. Ifwe look at the db variable, we can see that it refers to the testdatabase. >db test
  • 7. Store JavaScript 1. MongoDB comes with a JavaScript shell that allows interaction with a MongoDB instance from the command line 2.We can store and use JavaScript functions and values on the server side
  • 8. Wrapped Queries 1. LikeQuery db.Tag.find( {name:/^term/}); 2. SortQuery 1 for ascending sort -1for descending sort db.Tag.find().sort( {userName:-1, age:1}); 3. LimitQuery db.Tag.find().limit(10);
  • 9. Wrapped Queries ... 4. CountQuery db.Tag.find().count(); 5. SkipQuery db.Tag.find().skip(50); NOTE:A good way of figuring out what a function isdoing isto type it without the parentheses. This will print the JavaScript source code for the function.
  • 10. Query using Modifiers 1. NotEqualModifier($ne) db.Tag.find({firstProperty :{$ne :3}}); 2. Greater/LessthanModifier($gt,$lt,$gte,$lte) db.Tag.find({firstProperty :{$gt :2}}); db.Tag.find({firstProperty :{$lt :2}}); db.Tag.find({firstProperty :{$gte :2}}); db.Tag.find({firstProperty :{$lte :2}});
  • 11. Query using Modifiers ... 3. IncrementModifier($inc) db.Tag.update( {thirdProperty:"Helo19"}, {"$inc": {firstProperty:2}}) 4. SetModifire($set) db.Tag.update( {thirdProperty:"Helo19"}, {"$set":{fourthProperty: "newValue"}}) NOTE:Key-value will be created if the key doesn't existsyet in the case of both $set and $inc. $inc works for integers only. $set works for all. $inc Incrementing isextremely fast, so any performance penaltyisnegligible.
  • 12. Query using Modifiers ... 5. UnsetModifier($unset) db.Tag.update( {thirdProperty:"Helo19"}, {"$unset": {fourthProperty: "anything"}}) 6. PushModifire($push) db.Blog.update( {title:"1st Blog"},{$push: {comment:"1st Comment"}}); NOTE:"$push" adds an element to the end of an array if the specified key already existsand creates a new array if it does not.
  • 13. Query using Modifiers ... 7. AddToSetModifier($addToSet) db.Blog.update( {title:"1st Blog"},{$addToSet: {comment:"2nd Comment"} }); 8.PopModifier($pop) comment =-1remove an element from start. comment =1 remove an element fromend db.Blog.update( {title:"1stBlog"},{$pop:{comment:-1} });
  • 14. Query using Modifiers ... 9. Pul Modifier($pull) db.Blog.update({title:"1st Blog"},{$pul:{comment:"2st Comment"}}) NOTE:Pulling removes all matching documents, not justa single match. 10.PositionOperator($)The positional operator updates only the firstmatch. db.embededDocument.update({"comments.author" :"John"}, {"$inc" :{"comments.0.votes":1}}) db.embededDocument.update({"comments.votes" :3}, {"$set": {"comments.$.author" : "AmitKumar"}})
  • 15. Upsert(SaveOrUpdate Query) An upsert isa special type of update. 1. Ifno document isfound that matches the update criteria, a new document will be created by combining the criteria and update documents. 2. Ifa matching document isfound, it will be updated normally. db.Tag.update(document1, document2, true); db.Tag.update({secondProperty:”Jav”}, {"$inc":{"firstProperty":100}},true) db.Tag.save(document) Note: save works onId only.
  • 16. Updating Multiple Documents Updates, by default, update only the first document found that matches the criteria. Ifthere are more matching documents, they will remain unchanged. Tomodify all of the documents matching the criteria, you can pass true as the fourth parameter to update. db.Tag.update(document1, document2, false, true); db.Tag.update({secondProperty:/J/}, {"$inc":{"firstProperty":100}},false, true)
  • 17. Specifying Which Keys to Return Sometimes, you do not need all of the key/value pairs in a document returned. If this is the case, you can pass a second argument to find (or findOne) specifying the keys you want. This reduces both the amount of data sent over the wire and the time and memory used to decode documents on the client side. db.Tag.find({}, {_id:0,firstProperty:1})
  • 18. OR Queries There are two ways to do an OR query. 1."$in"can be used to query for a variety of values for a single key. db.Blog.find( {comment: {$in:["5thComment", "1stComment"]} }) 2."$or"ismore general; it can be used to query for any of the given values across multiple keys. db.Tag.find( {$or:[{firstProperty:0},{secondProperty:/J/} ]}) NOTE:The opposite of "$in"is"$nin".
  • 19. AND Queries There are two ways to do an AND query. 1."$al" can be used to query for a variety of values for a single key. db.Blog.find( {comment:{$al:["5th Comment", "1stComment"]} }) NOTE: Below will do exact match and order too matters, if order will change then it will notmatch. db.Blog({"comment" : ["5thComment", "comment1stComment"]})
  • 20. AND Queries ... 2.Simple queries are and queries. Itcan be used to query for any of the given values across single/multiple keys. db.Tag.find( {firstProperty:0, secondProperty:/J/} ) db.Blog.find({comment:"5th Comment",comment:"1st Comment"})
  • 21. Querying on Embedded Document There are two ways of querying for an embedded document. 1.Querying for an entire embedded document works identically to a normal query. db.User.find( {name: {first:"Amit",last:"Kumar"}}) Thisquery will do exact match and order too matters, if order will change then it will not find. 2.Querying for its individual key/value pairs. db.User.find({"name.first" : "Amit","name.last" :"Kumar"})
  • 22. Cursors The database returns results from find using a cursor. If we do not store the resultsin a variable, the MongoDB shell will automatically iterate through and display the first couple of documents. When you call find, the shell does not query the database immediately. Itwaits until you actually start requesting resultsto send the query, which allows you to chain additional options onto a query before it is performed. Almost every method on a cursor object returns the cursor itself so that you can chain them in any order. For instance, all of the following are equivalent >var cursor =db.Tag.find().sort({"x":1}).limit(1).skip(10); >var cursor =db.Tag.find().limit(1).sort({"x":1}).skip(10); >var cursor =db.Tag.find().skip(10).limit(1).sort({"x":1});
  • 23. Indexing Indexes are the way to make queries go vroom. Suppose that you are querying for a single key, such as the following: db.User.find({"username":"mark"}) When only a single key is used in the query, that key can be indexed to improve the query’s speed. In this case, you would create an index on "username". Tocreate the index, use the ensureIndex method: db.User.ensureIndex({"username":1})
  • 24. Geospatial Indexing There is another type of query that is becoming increasingly common (especially with the emergence of mobile devices): finding the nearest N things to acurrent location. 1. MongoDB provides a special type of index for coordinate plane queries, called a geospatialindex. 2. A geospatial index can be created using the ensureIndex function, but by passing "2d" as a value instead of 1 or -1: db.User.ensureIndex({"location" :"2d"})
  • 25. Geospatial Indexing ... The "location" key must be some type of pair value, that is, a two-element array or embedded document with two keys.The keys can be anything: {"location" : [0,100]} {"location" : {"x":-30,"y": 30 }} {"location" :{"latitude" : -180,"longitude" :180 } } {"location" : {"foo": 0,"bar" :1}}
  • 26. Geospatial Indexing ... Geospatial queries can be performed in two ways: 1. As a normal query (using find): The find approach issimilarto performing a nongeospatial query, except the conditional "$near" is used. It takes an array of the two target values: db.User.find({"location" : {"$near": [40,-73]}}) 2. GeoNear command: ”geoNear” also returns the distance of each result document from the querypoint. db.runCommand({geoNear : "User",near : [40,-73],num :10});
  • 27. Contact us Here’s how TOTHENEW uses MongoDB to create a rich experience for your customers! Click Here To Know More! Have more queries related to MongoDB? Talk To Our Experts! Our Office Client Location