Lesson 4 MongoDB Data Query (1): mongodb Data Query
1. Course outlineThis course mainly describes MongoDB Data Query related content, including the introduction and use of the find function, query operator introduction and use, embedded document query, and array query. 1. Introduction and use of the find function 2. introduction and use of query operators 3. embedded document query and array Query
2. course IntroductionIn this lesson, we will first give a detailed introduction to the find function, and then explain several issues that need attention when using find. Finally, we will demonstrate the use of the find function. First, let's give a brief introduction to data query. MongoDB uses the find function for document query. Its function is the same as the select function in SQL, but it is different from the relational database's support for multi-Table connection query, the find function can operate only one set. MongoDB provides many query operators and many functions similar to those of relational databases, including ing, sorting, and limiting the number of returned results. In addition, it also provides operators for arrays, this is not available in relational databases. The find function is described in detail below. Db. set Name. the find (query, fields, limit, skip, batchSize, options) function has four parameters: the query parameter is a document type, it has the same meaning as the remove function and the first parameter of the update function introduced in the last lesson. It is used to specify the query conditions, which is equivalent to the where statement in SQL. The fileds parameter is used for field ing. By default, MongoDB returns all fields matching the document and sets the fields to be returned using the projecing (projection) to retrieve the subset of the document fields, it is equivalent to the field we need after SELECT in SQL. The limit parameter is used to limit the number of documents in the query result set. It is used to specify the upper limit, not the lower limit. If the number of documents in the result set is smaller than the limit, returns the entire result set. The skip parameter is used to skip a document that ignores a certain amount of data. It is used to set the offset of the first returned document. If the number of matched documents in the set is smaller than the number of skipped documents, the returned result is null, like the limit parameter, the skip parameter is also an integer. The Return Value of the find function is a cursor.3. Detailed course videoThe video course link is as follows: [MongoDB Data Query (1)]
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.