ODTUG Webcast - Thinking Clearly about XMLMarco Gralike
Presentation slides used during ODTUG Webcast on the 19th of January explaining first steps in Oracle XMLDB (including extended demo's)
https://www3.gotomeeting.com/register/660686966
ODTUG Webcast - Thinking Clearly about XMLMarco Gralike
Presentation slides used during ODTUG Webcast on the 19th of January explaining first steps in Oracle XMLDB (including extended demo's)
https://www3.gotomeeting.com/register/660686966
XFILES, The APEX 4 version - The truth is in thereMarco Gralike
XFILES on APEX presentation, in cooperation with Roel Hartman. The presentation demonstrated implementing versioning for Oracle APEX based on XMLDB versioning functionality.
More info and APEX source code can be found via
http://xace.sourceforge.net
XFILES, The APEX 4 version - The truth is in thereMarco Gralike
XFILES on APEX presentation, in cooperation with Roel Hartman. The presentation demonstrated implementing versioning for Oracle APEX based on XMLDB versioning functionality.
More info and APEX source code can be found via
http://xace.sourceforge.net
This presentation is related to nosql database and nosql database types information. this presentationa also contains discussion about, how mongodb works and mongodb security and mongodb sharding information.
Agenda:
MongoDB Overview/History
Workshop
1. How to perform operations to MongoDB – Workshop
2. Using MongoDB in your Java application
Advance usage of MongoDB
1. Performance measurement comparison – real life use cases
3. Doing Cluster setup
4. Cons of MongoDB with other document oriented DB
5. Map-reduce/ Aggregation overview
Workshop prerequisite
1. All participants must bring their laptops.
2. https://github.com/geek007/mongdb-examples
3. Software prerequisite
a. Java version 1.6+
b. Your favorite IDE, Preferred http://www.jetbrains.com/idea/download/
c. MongoDB server version – 2.6.3 (http://www.mongodb.org/downloads - 64 bit version)
d. Participants can install MongoDB client – http://robomongo.org/
About Speaker:
Akbar Gadhiya is working with Ishi Systems as Programmer Analyst. Previously he worked with PMC, Baroda and HCL Technologies.
MongoDB (from humongous) is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster. Released under a combination of the GNU Affero General Public License and the Apache License, MongoDB is free and open-source software.
MongoDB .local London 2019: Fast Machine Learning Development with MongoDBMongoDB
Today an increasingly large number of products use machine learning and AI to deliver a great personalized user experience, and workplace software is no exception. Spoke goes beyond traditional ticketing with their friendly, AI-powered chatbot that gives workplace teams hours of time back as it automatically responds to questions on Slack, email, SMS, and web. Learn how Spoke uses MongoDB to do dynamic model training in real time from user interaction data and serves thousands of models, with multiple customized models per client.
MongoDB .local London 2019: Fast Machine Learning Development with MongoDBLisa Roth, PMP
Today an increasingly large number of products use machine learning and AI to deliver a great personalized user experience, and workplace software is no exception. Spoke goes beyond traditional ticketing with their friendly, AI-powered chatbot that gives workplace teams hours of time back as it automatically responds to questions on Slack, email, SMS, and web. Learn how Spoke uses MongoDB to do dynamic model training in real time from user interaction data and serves thousands of models, with multiple customized models per client.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
Data privacy is one of the most critical issues that businesses face. This presentation shares insights on the principles and best practices for ensuring the resilience and security of your workload.
Drawing on a real-life project from the HR industry, the various challenges will be demonstrated: data protection, self-healing, business continuity, security, and transparency of data processing. This systematized approach allowed to create a secure AWS cloud infrastructure that not only met strict compliance rules but also exceeded the client's expectations.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
2. Outline
Introduction
Overview of MongoDB’s Documents, Collections and Databases
Comparison of RDBMS and MongoDB
More on ObjectID
MongoDB Datatypes
Document Sample
MongoDB Advantages and where to use it
Create and Drop for Collections, Documents and Databases
CRUD Operations for Documents
Relations in MongoDB
Projection
Limiting, Sorting and Indexing in MongoDB
Replication and Sharding in Mongo DB
Companies that use MongoDB
3. MongoDB is an open-source document database
and leading NoSQL database. MongoDB is written
mostly in C++.
Released in 2009
Initial Release
Document Based
Types of NoSQL Databases:
• Document-Based
• Key-value stores
• Wide Column
• Graph
NoSQL Humongous
Scalable & Reliable
Cross-Platform
Available on Different Platforms
4. Overview
Database
Database is a physical container for collections. Each database gets its own set of
files on the file system. A single MongoDB server typically has multiple databases.
Collection
Collection is a group of MongoDB documents. It is the equivalent of an RDBMS
table. A collection exists within a single database. Collections do not enforce a
schema. Documents within a collection can have different fields. Typically, all
documents in a collection are of similar or related purpose.
Document
A document is a set of key-value pairs. Documents have dynamic schema.
Dynamic schema means that documents in the same collection do not need to
have the same set of fields or structure, and common fields in a collection's
documents may hold different types of data.
5. RDBMS vs MongoDB
RDBMS MongoDB
Database Database
Table Collection
Tuple/Row Document
column Field
Table Join Embedded Documents
Primary Key Primary Key (Default key _id provided
by MongoDB itself)
Database Server and Client
mysqld/Oracle mongod
mysql/sqlplus mongo
6. Advantages
Schema less − MongoDB is a document database in which one collection holds
different documents. Number of fields, content and size of the document can
differ from one document to another.
Structure of a single object is clear.
No complex joins.
Deep query-ability. MongoDB supports dynamic queries on documents using a
document-based query language that's nearly as powerful as SQL.
Tuning.
Ease of scale-out − MongoDB is easy to scale.
Uses internal memory for storing the (windowed) working set, enabling faster
access of data.
7. Why MongoDB?
Document Oriented Storage − Data is stored in the form of JSON style
documents.
Index on any attribute
Replication and high availability
Auto-Sharding
Rich queries
Fast in-place updates
8. Where to Use MongoDB?
Big Data
Content Management and Delivery
Mobile and Social Infrastructure
User Data Management
Data Hub
9. Sample Document
{
"_id" : ObjectId("5ecb9ea70403c0aa6001b4a2"),
"brand" : "BMW",
"model" : "X5",
"tier" : "B",
"max_speed" : 220,
"color" : "Black",
"airbags" : [
"front-seats",
"back-seats",
"other places"
]
}
_id is 12 bytes hexadecimal number
unique for every document in a
collection. You can provide it
yourself too!
10. ObjectID
An ObjectId is a 12-byte BSON type having the following structure
Generate By mongoDB
>newObjectId = ObjectId() ObjectId("5349b4ddd2781d08c09890f3")
Generate By us
>myObjectId = ObjectId("5349b4ddd2781d08c09890f4")
11. Datatypes
String − This is the most commonly used datatype to store the data. String in MongoDB must be UTF-8 valid.
Integer − This type is used to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.
Boolean − This type is used to store a boolean (true/ false) value.
Double − This type is used to store floating point values.
Min/ Max keys − This type is used to compare a value against the lowest and highest BSON elements.
Arrays − This type is used to store arrays or list or multiple values into one key.
Timestamp − ctimestamp. This can be handy for recording when a document has been modified or added.
Object − This datatype is used for embedded documents.
Null − This type is used to store a Null value.
Symbol − This datatype is used identically to a string; however, it's generally reserved for languages that use a specific
symbol type.
Date − This datatype is used to store the current date or time in UNIX time format. You can specify your own date time by
creating object of Date and passing day, month, year into it.
Object ID − This datatype is used to store the document’s ID.
Binary data − This datatype is used to store binary data.
Code − This datatype is used to store JavaScript code into the document.
Regular expression − This datatype is used to store regular expression.
12. Create & Drop Database
MongoDB use DATABASE_NAME is used to create database. The command will
create a new database if it doesn't exist, otherwise it will return the existing
database.
MongoDB db.dropDatabase() command is used to drop a existing database.
Example:
use divarDB
db.dropDatabase()
If you want to check your databases list, use the command show dbs.
13. Create Collections
MongoDB db.createCollection(name, options) is used to create collection.
db.createCollection("mycol", { capped : true, autoIndexID : true, size : 6142800,
max : 10000 } )
Parameter Type
Name String
Options Document
Field Type Description
capped Boolean
If true, enables a capped collection. Capped
collection is a fixed size collection that
automatically overwrites its oldest entries when
it reaches its maximum size. If you specify true,
you need to specify size parameter also.
autoIn
dexId
Boolean
If true, automatically create index on _id fields.
size number
Specifies a maximum size in bytes for a capped
collection. If capped is true, then you need to
specify this field also.
max number
Specifies the maximum number of documents
allowed in the capped collection.
14. Drop Collections
MongoDB's db.collection.drop() is used to drop a collection from the
database.
show collections is used to show all collections in the current
Example:
db.mycollection.drop()
15. Insert Document
To insert data into MongoDB collection, you need to use
MongoDB's insert() or save() method.
If you need to insert only one document you can use insertOne() method.
You can insert multiple documents using the insertMany() method. To this method you
need to pass an array of documents.
Example:
db.stuff.insert({ title: "MongoDB Insert Docs", description: "MongoDB is no sql database",
tags: ['mongodb', 'database', 'NoSQL'], likes: 100 })
db.presenters.insertMany([
{
First_Name: “Shayan",
Last_Name: “Daneshvar",
},
{
First_Name: “Hashem",
Last_Name: “Pourallahverdi",
}])
16. Query Document
how to query document from MongoDB collection.
The find() Method
The pretty() Method
The findOne() method
AND
OR
NOR
NOT
Operation Syntax Example RDBM S Equivalent
Equality {<key>:{$eg;<value>}} db.mycol.find({"by":"kntu"}).pretty() where by = 'kntu'
Less Than {<key>:{$lt:<value>}} db.mycol.find({"likes":{$lt:50}}).pretty() where likes < 50
Less Than
Equals
{<key>:{$lte:<value>}} db.mycol.find({"likes":{$lte:50}}).pretty() where likes <= 50
Greater Than {<key>:{$gt:<value>}} db.mycol.find({"likes":{$gt:50}}).pretty() where likes > 50
Greater Than
Equals
{<key>:{$gte:<value>}} db.mycol.find({"likes":{$gte:50}}).pretty() where likes >= 50
Not Equals {<key>:{$ne:<value>}} db.mycol.find({"likes":{$ne:50}}).pretty() where likes != 50
Values in an
array
{<key>:{$in:[<value1>,
<value2>,……<valueN>]
}}
db.mycol.find({"name":{$in:["Raj","Ram","Raghu"])
.pretty()
Where name matches any of the
value in :["Raj", "Ram", "Raghu"]
Values not in
array
{<key>:{$nin:<value>}} db.mycol.find({"name":{$nin:["Ramu","Raghav"]}})
.pretty()
Where name values is not in the
array :["Ramu", "Raghav"] or,
doesn’t exist at all
18. Update Document
MongoDB's update() and save() methods are used to update document into a
collection.
update() Vs save()
>db.COLLECTION_NAME.update(SELECTION_CRITERIA, UPDATED_DATA)
>db.COLLECTION_NAME.save({_id:ObjectId(),NEW_DATA})
findOneAndUpdate()
updateOne()
updateMany(<filter>, <update>)
19. Delete Document
MongoDB's remove() method accepts two parameters. One is deletion criteria
and second is justOne flag.
deletion criteria − (Optional) deletion criteria according to documents will be
removed.
justOne − (Optional) if set to true or 1, then remove only one document.
21. Projection
In MongoDB, projection means selecting only the necessary data rather than
selecting whole of the data of a document.
The find() Method
>db.COLLECTION_NAME.find({},{KEY:1})
Example :
{_id : ObjectId("507f191e810c19729de860e1"), title: "MongoDB Overview"},
{_id : ObjectId("507f191e810c19729de860e2"), title: "NoSQL Overview"},
{_id : ObjectId("507f191e810c19729de860e3"), title: “Redis Overview"}
>db.mycol.find({},{"title":1,_id:0})
{"title":"MongoDB Overview"} {"title":"NoSQL Overview"} {"title":“Redis Overview"}
_id field is always displayed while executing find() method, if you don't want this field, then you
need to set it as 0.
22. Limiting Records
To limit the records in MongoDB we use two method :
The Limit() Method
Skip() Method
These methods accepts one number type argument, which is the number of
documents that you want to be displayed or passed.
Example :
{_id : ObjectId("507f191e810c19729de860e1"), title: "MongoDB Overview"},
{_id : ObjectId("507f191e810c19729de860e2"), title: "NoSQL Overview"},
{_id : ObjectId("507f191e810c19729de860e3"), title: “Redis Overview"}
>db.mycol.find({},{"title":1,_id:0}).limit(1).skip(1)
{"title":"NoSQL Overview"}
23. Sorting Records
The method accepts a document containing a list of fields along with their
sorting order. To specify sorting order 1 and -1 are used. 1 is used for
ascending order while -1 is used for descending order.
The sort() Method
>db.COLLECTION_NAME.find().sort({KEY:1})
24. Indexing
Indexes support the efficient resolution of queries. Without indexes, MongoDB
must scan every document of a collection to select those documents that
match the query statement.
The createIndex() Method >db.COLLECTION_NAME.createIndex({KEY:1/-1})
The method has some other parameters and I passed.
The dropIndex() method >db.COLLECTION_NAME.dropIndex({KEY:1})
The getIndexes() method : returns the description of all the indexes in the
collection.
25. Aggregation
Aggregations operations process data records and return computed results.
In SQL count(*) and with group by is an equivalent of MongoDB aggregation.
aggregate() Method
>db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION)
$sum,$avg,$min,$max,$first,$last
$push : Inserts the value to an array in the resulting document.
$addToSet : Inserts the value to an array in the resulting
document but does not create duplicates.
26. Aggregation
Following are the possible stages in aggregation framework
$project − Used to select some specific fields from a collection.
$match − This is a filtering operation and thus this can reduce the amount
of documents that are given as input to the next stage.
$group − This does the actual aggregation as discussed above.
$sort − Sorts the documents.
$skip − With this, it is possible to skip forward in the list of documents for
a given amount of documents.
$limit − This limits the amount of documents to look at, by the given
number starting from the current positions.
$unwind − This is used to unwind document that are using arrays. When
using an array, the data is kind of pre-joined and this operation will be
undone with this to have individual documents again. Thus with this stage
we will increase the amount of documents for the next stage.
27. Replication
is the process of synchronizing data across multiple servers.
provides redundancy and increases data availability with multiple copies of data
on different database servers.
protects a database from the loss of a single server.
allows you to recover from hardware failure and service interruptions.
MongoDB achieves replication by the use of replica set. A replica set is a group
of mongod instances that host the same data set.
Replica Set Features
A cluster of N nodes
Any one node can be primary
All write operations go to primary
Automatic failover--a method of protecting computer system
Automatic recovery
Consensus election of primary
28. Sharding
is the process of storing data records across multiple machines and it is
MongoDB's approach to meeting the demands of data growth.
solves the problem with horizontal scaling.
Why Sharding?
In replication, all writes go to master node
Latency sensitive queries still go to master
Single replica set has limitation of 12 nodes
Memory can't be large enough when active dataset is big
Local disk is not big enough
Vertical scaling is too expensive
29. Sharding in MongoDB
Shards − Shards are used to store data.
Config Servers − Config servers store the cluster's metadata. This data
contains a mapping of the cluster's data set to the shards. The query
router uses this metadata to target operations to specific shards.
Query Routers − Query routers are basically mongo instances,
interface with client applications and direct operations to the
appropriate shard.