Docs Home → MongoDB Manual
On this page
- Select All Documents in a Collection
- Specify Equality Condition
- Specify Conditions Using Query Operators
- Specify AND Conditions
- Specify OR Conditions
- Additional Query Tutorials
- Behavior
➤ Use the Select your language drop-down menu in the upper-right to set the language of the following examples.
This operation corresponds to the following SQL statement:
The following example selects from the inventory collection all documents where the status equals "D":
This operation corresponds to the following SQL statement:
SELECT * FROM inventory WHERE status = "D"
The following example retrieves all documents from the inventory collection where status equals either "A" or "D":
Note
Although you can express this query using the $or operator, use the $in operator rather than the $or operator when performing equality checks on the same field.
The operation corresponds to the following SQL statement:
SELECT * FROM inventory WHERE status in ("A", "D")
Refer to the Query and Projection Operators document for the complete list of MongoDB query operators.
A compound query can specify conditions for more than one field in the collection's documents. Implicitly, a logical AND conjunction connects the clauses of a compound query so that the query selects the documents in the collection that match all the conditions.
The following example retrieves all documents in the inventory collection where the status equals "A" and qty is less than ($lt) 30:
The operation corresponds to the following SQL statement:
SELECT * FROM inventory WHERE status = "A" AND qty < 30
See comparison operators for other MongoDB comparison operators.
Using the $or operator, you can specify a compound query that joins each clause with a logical OR conjunction so that the query selects the documents in the collection that match at least one condition.
The following example retrieves all documents in the collection where the status equals "A" or qty is less than ($lt) 30:
The operation corresponds to the following SQL statement:
SELECT * FROM inventory WHERE status = "A" OR qty < 30
Note
In the following example, the compound query document selects all documents in the collection where the status equals "A" and either qty is less than ($lt) 30 or item starts with the character p:
The operation corresponds to the following SQL statement:
SELECT * FROM inventory WHERE status = "A" AND ( qty < 30 OR item LIKE "p%")
Note
MongoDB supports regular expressions $regex queries to perform string pattern matches.
For additional query examples, see:
Query on Embedded/Nested Documents
Query an Array
Query an Array of Embedded Documents
Project Fields to Return from Query
Query for Null or Missing Fields
For reads to replica sets and replica set shards, read concern allows clients to choose a level of isolation for their reads. For more information, see Read Concern.
1) The general ledger and reporting system consists of the ________ involved in ________ the
general ledger and ________ reports.
C) information processing; updating; creating
Answer: C
2) Which item below is not considered a major input to the general ledger and reporting system?
B) reports from managers
Answer: B
3) Who should provide the adjusting entries in a well-designed general ledger and reporting
system?
D) the controller's area
Answer: D
4) Which of the following user groups generally receive information produced by the general
ledger and reporting system?
D) all of the above
Answer: D
5) The general ledger system of an organization should be designed to serve the information
requirements of both internal and external users. This means that the system should support
C) producing regular periodic reports and respond to real-time inquiry needs.
Answer: C
6) Identify the most correct statement with regard to how the various accounting subsystems
update the general ledger.
B) Summary journal entries that represent the results of all transactions for a certain time
period are used to update the general ledger.
Answer: B
7) When updating the general ledger, sales, purchases, and production are examples of ________
entries, and issuance or retirement of debt and the purchase or sale of investment securities are
examples of ________ entries.
B) accounting subsystem; treasurer originated
Answer: B
8) Which of the following are used to document entries made to update the general ledger?
D) journal vouchers
Answer: D
9) Not all journal entries affect cash flow. Adjusting entries that reflect events that have already
occurred, but have no effect on cash, are classified as
A) accruals.
Answer: A