www.mongodb.com Open in urlscan Pro
2600:9000:2490:ce00:7:7859:3840:93a1  Public Scan

Submitted URL: https://email.mongodb.com/u/click?_t=86ba93b39a0e415ea7cd8e8ed81051cd&_m=2c2acfdf9a844b0eb879558eb186a3cb&_e=LHmntqAbVk9RR...
Effective URL: https://www.mongodb.com/docs/manual/core/views/?utm_source=Iterable&utm_medium=email&utm_campaign=campaign_9079740
Submission: On February 23 via manual from US — Scanned from DE

Form analysis 1 forms found in the DOM

GET https://mongodb.com/docs/search/

<form role="search" method="GET" action="https://mongodb.com/docs/search/" class="css-1c69emu">
  <div class="css-1q5aj3">
    <div class="css-36i4c2"><input type="text" placeholder="Search all documentation..." class="css-etrcff" value=""></div>
    <div class="css-1hc92ka">
      <div class="css-aef77t"><button role="button" type="button" class="css-14k7wrz"><span data-testid="selected-value" class="css-6k4l2y">All Documentation</span>
          <div class="css-109dpaz"><svg data-testid="icon" width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg" class="css-1yzkxhp">
              <path d="M1.06689 0.799988L8.00023 7.73332L14.9336 0.799988" stroke-linecap="round" stroke-linejoin="round" class="css-1tlq8q9"></path>
            </svg></div>
        </button>
        <div class="css-hn9qqo">
          <ul data-testid="options" role="listbox" class="css-ac9zo2">
            <li role="option" tabindex="0" class="css-11dtrvq">General Information</li>
            <li role="option" tabindex="0" class="css-11dtrvq">All Documentation</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Realm Documentation</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Developer Articles &amp; Topics</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Community Forums</li>
            <li role="option" tabindex="0" class="css-11dtrvq">Blog</li>
            <li role="option" tabindex="0" class="css-11dtrvq">University</li>
          </ul>
        </div>
      </div><input type="hidden" id="q" name="q" value="">
      <div class="css-1myrko"><button type="submit" tabindex="0" class=" css-13l1z36" data-track="true"><img alt="search icon" src="https://webimages.mongodb.com/_com_assets/cms/krc3hljsdwdfd2w5d-web-actions-search.svg?auto=format%252Ccompress"
            class="css-r9fohf"></button></div>
    </div>
  </div>
</form>

Text Content

All Documentation

 * General Information
 * All Documentation
 * Realm Documentation
 * Developer Articles & Topics
 * Community Forums
 * Blog
 * University


 * Products
   Platform
   AtlasBuild on a developer data platform
   Platform Services
   DatabaseDeploy a multi-cloud databaseSearchDeliver engaging search
   experiencesVector SearchDesign intelligent apps with GenAIStream Processing
   (Preview)Unify data in motion and data at rest
   Tools
   CompassWork with MongoDB data in a GUIIntegrationsIntegrations with
   third-party servicesRelational MigratorMigrate to MongoDB with confidence
   Self Managed
   Enterprise AdvancedRun and manage MongoDB yourselfCommunity EditionDevelop
   locally with MongoDB
   Build with MongoDB Atlas
   Get started for free in minutes
   Sign Up
   Test Enterprise Advanced
   Develop with MongoDB on-premises
   Download
   Try Community Edition
   Explore the latest version of MongoDB
   Download
 * Resources
   Documentation
   Atlas DocumentationGet started using AtlasServer DocumentationLearn to use
   MongoDBStart With GuidesGet step-by-step guidance for key tasks
   
   Tools and ConnectorsLearn how to connect to MongoDBMongoDB DriversUse drivers
   and libraries for MongoDB
   AI Resources HubGet help building the next big thing in AI with
   MongoDBarrow-right
   Connect
   Developer CenterExplore a wide range of developer resourcesCommunityJoin a
   global community of developersCourses and CertificationLearn for free from
   MongoDBWebinars and EventsFind a webinar or event near you
 * Solutions
   Use cases
   Artificial IntelligenceEdge ComputingInternet of
   ThingsMobilePaymentsServerless Development
   Industries
   Financial ServicesTelecommunicationsHealthcareRetailPublic
   SectorManufacturing
   Solutions LibraryOrganized and tailored solutions to kick-start
   projectsarrow-right
   Developer Data Platform
   Accelerate innovation at scale
   Learn morearrow-right
   Startups and AI Innovators
   For world-changing ideas and AI pioneers
   Learn morearrow-right
   Customer Case Studies
   Hear directly from our users
   See Storiesarrow-right
 * Company
   CareersStart your next adventureBlogRead articles and
   announcementsNewsroomRead press releases and news stories
   PartnersLearn about our partner ecosystemLeadershipMeet our executive
   teamCompanyLearn more about who we are
   Contact Us
   Reach out to MongoDB
   Let’s chatarrow-right
   Investors
   Visit our investor portal
   Learn morearrow-right
 * Pricing

SupportSign In
Try Free
menu-vertical

Docs Menu
   
   MongoDB Documentation
   
   --------------------------------------------------------------------------------
   
   Back to Develop Applications
 * MongoDB Manual
   7.0 (current)
 * Introduction
 * Getting Started
 * Create an Atlas Free Tier Cluster
 * Databases and Collections
 * Views
 * Create and Query a View
 * Use a View to Join Two Collections
 * Create a View with Default Collation
 * Modify a View
 * Remove a View
 * Supported Operations for Views
 * On-Demand Materialized Views
 * Capped Collections
 * Clustered Collections
 * Documents
 * MongoDB Query API
 * BSON Types
 * Installation
 * MongoDB Shell (mongosh)
 * MongoDB CRUD Operations
 * Aggregation Operations
 * Indexes
 * Atlas Search
 * Atlas Vector Search
 * Time Series
 * Change Streams
 * Transactions
 * Data Modeling
 * Replication
 * Sharding
 * Storage
 * Administration
 * Security
 * Frequently Asked Questions
 * Reference
 * Release Notes
 * Technical Support

 * 



Docs Home → Develop Applications → MongoDB Manual


VIEWS


On this page

 * Use Cases
 * Create and Manage Views
 * Comparison with On-Demand Materialized Views
 * Behavior
 * Access Control

A MongoDB view is a read-only queryable object whose contents are defined by an
aggregation pipeline on other collections or views.

MongoDB does not persist the view contents to disk. A view's content is computed
on-demand when a client queries the view.


NOTE


DISAMBIGUATION

This page discusses standard views. For discussion of on-demand materialized
views, see On-Demand Materialized Views.

To understand the differences between the view types, see Comparison with
On-Demand Materialized Views.

You can create materialized views in the UI for deployments hosted in MongoDB
Atlas.


USE CASES


You can use views to:

 * Create a view on a collection of employee data to exclude any personally
   identifiable information (PII). Your application can query the view for
   employee data that does not contain any PII.

 * Create a view on a collection of sensor data to add computed fields and
   metrics. Your application can use find operations to query the computed data.

 * Create a view that joins two collections containing inventory and order
   history. Your application can query the view without managing or
   understanding the underlying pipeline.


CREATE AND MANAGE VIEWS


To learn how to create and manage views, see the following resources:

 * Create a Materialized View in the MongoDB Atlas UI

 * Create and Query a View

 * Use a View to Join Two Collections

 * Create a View with Default Collation

 * Modify a View

 * Remove a View


COMPARISON WITH ON-DEMAND MATERIALIZED VIEWS


MongoDB provides two different view types: standard views and on-demand
materialized views. Both view types return the results from an aggregation
pipeline.

 * Standard views are computed when you read the view, and are not stored to
   disk.

 * On-demand materialized views are stored on and read from disk. They use a
   $merge or $out stage to update the saved data.


INDEXES


Standard views use the indexes of the underlying collection. As a result, you
cannot create, drop or re-build indexes on a standard view directly, nor get a
list of indexes on the view.

You can create indexes directly on on-demand materialized views because they are
stored on disk.


PERFORMANCE


On-demand materialized views provide better read performance than standard views
because they are read from disk instead of computed as part of the query. This
performance benefit increases based on the complexity of the pipeline and size
of the data being aggregated.


BEHAVIOR


The following sections describe behavior specific to views.


READ ONLY


Views are read-only. Write operations on views return an error.


VIEW PIPELINES


The view's underlying aggregation pipeline is subject to the 100 megabyte memory
limit for blocking sort and blocking group operations.

Starting in MongoDB 6.0, pipeline stages that require more than 100 megabytes of
memory to execute write temporary files to disk by default. In earlier verisons
of MongoDB, you must pass { allowDiskUse: true } to individual find and
aggregate commands to enable this behavior.

Individual find and aggregate commands may override the allowDiskUseByDefault
parameter by either:

 * Using { allowDiskUse: true } to allow writing temporary files out to disk
   when allowDiskUseByDefault is set to false

 * Using { allowDiskUse: false } to prohibit writing temporary files out to disk
   when allowDiskUseByDefault is set to true


TIME SERIES COLLECTIONS


 * Time series collections are writable non-materialized views. Limitations for
   views apply to time series collections. For more information, see Time Series
   Collection Limitations.

 * You cannot create a view from a time series bucket collection namespace
   (namely, a collection prefixed with system.buckets).


WARNING

Do not attempt to create a time series collection or view with the name
system.profile. MongoDB 6.3 and later versions return an IllegalOperation error
if you attempt to do so. Earlier MongoDB versions crash.


ACCESS CONTROL


If the deployment enforces authentication, db.createView() requires that the
authenticated user have the createCollection privilege on the database.

However, if the user has the createCollection on the database and find on the
view to create, the user must also have the following additional permissions:

 * find on the source collection or view.

 * find on any other collections or views referenced in the pipeline, if any.

A user with the readWrite built in role on the database has the required
privileges to run the listed operations. Either create a user with the required
role or grant the role to an existing user

←  Databases and CollectionsCreate and Query a View →

On this page

 * Use Cases
 * Create and Manage Views
 * Comparison with On-Demand Materialized Views
 * Behavior
 * Access Control

Rate this page

Ask MongoDB AI

© 2023 MongoDB, Inc.

About

 * Careers
 * Investor Relations
 * Legal Notices
 * Privacy Notices
 * Security Information
 * Trust Center

Support

 * Contact Us
 * Customer Portal
 * Atlas Status
 * Customer Support

Social

 * GitHub
 * Stack Overflow
 * LinkedIn
 * YouTube
 * Twitter
 * Twitch
 * Facebook

© 2023 MongoDB, Inc.


By clicking "Accept All Cookies", you agree to the storing of cookies on your
device to enhance site navigation, analyze site usage, and assist in our
marketing efforts. You can enable and disable optional cookies as desired.Read
our Privacy Policy
Manage Cookies Accept All Cookies



PRIVACY PREFERENCE CENTER

"Cookies" are small files that enable us to store information while you visit
one of our websites. When you visit any website, it may store or retrieve
information on your browser, mostly in the form of cookies. This information
might be about you, your preferences or your device and is mostly used to make
the site work as you expect it to. The information does not usually directly
identify you, but it can give you a more personalized web experience. Because we
respect your right to privacy, you can choose not to allow some types of
cookies, but essential cookies are always enabled. Click on the different
category headings to find out more and change our default settings. However,
blocking some types of cookies may impact your experience of the site and the
services we are able to offer.
MongoDB Privacy Policy
Allow All


MANAGE CONSENT PREFERENCES

STRICTLY NECESSARY COOKIES

Always Active

These cookies are necessary for the website to function and cannot be switched
off in our systems. They are usually only set in response to actions made by you
which amount to a request for services, such as setting your privacy
preferences, logging in or filling in forms. You can set your browser to block
or alert you about these cookies, but some parts of the site will not then work.
These cookies do not store any personally identifiable information.

PERFORMANCE COOKIES

Performance Cookies

These cookies allow us to count visits and traffic sources so we can measure and
improve the performance of our site. They help us to know which pages are the
most and least popular and see how visitors move around the site. All
information these cookies collect is aggregated and therefore anonymous. If you
do not allow these cookies we will not know when you have visited our site, and
will not be able to monitor its performance.

FUNCTIONAL COOKIES

Functional Cookies

These cookies enable the website to provide enhanced functionality and
personalisation. They may be set by us or by third party providers whose
services we have added to our pages. If you do not allow these cookies then some
or all of these services may not function properly.

TARGETING COOKIES

Targeting Cookies

These cookies may be set through our site by our advertising partners. They may
be used by those companies to build a profile of your interests and show you
relevant adverts on other sites. They do not store directly personal
information, but are based on uniquely identifying your browser and internet
device. If you do not allow these cookies, you will experience less targeted
advertising.

SOCIAL MEDIA COOKIES

Social Media Cookies

These cookies are set by a range of social media services that we have added to
the site to enable you to share our content with your friends and networks. They
are capable of tracking your browser across other sites and building up a
profile of your interests. This may impact the content and messages you see on
other websites you visit. If you do not allow these cookies you may not be able
to use or see these sharing tools.

Back Button


COOKIE LIST



Search Icon
Filter Icon

Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label

Confirm My Choices