fix(guide): simplify directory structure

This commit is contained in:
Mrugesh Mohapatra
2018-10-16 21:26:13 +05:30
parent f989c28c52
commit da0df12ab7
35752 changed files with 0 additions and 317652 deletions

View File

@@ -0,0 +1,10 @@
---
title: Exercise Tracker
---
## Exercise Tracker
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/apis-and-microservices-projects/exercise-tracker/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: File Metadata Microservice
---
## File Metadata Microservice
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,13 @@
---
title: APIs and Microservices Projects
---
## APIs and Microservices Projects
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/quadratic-equations/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->

View File

@@ -0,0 +1,10 @@
---
title: Request Header Parser Microservice
---
## Request Header Parser Microservice
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/apis-and-microservices-projects/request-header-parser-microservice/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Timestamp Microservice
---
## Timestamp Microservice
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: URL Shortener Microservice
---
## URL Shortener Microservice
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/apis-and-microservices-projects/url-shortener-microservice/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,24 @@
---
title: Chain Middleware to Create a Time Server
---
## Chain Middleware to Create a Time Server
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
Similar to the last challenge, but now we are chaining 2 functions together. It seems complicated, but it's just javascript.
Instead of responding with the time we can also add a string to the request and pass it to the next function. This is trivial, but it makes for a decent example. The code looks like:
```javascript
app.get("/now", middleware(req, res, next) {
req.string = "example";
next();
},
function (req, res) {
res.send(req.string); // This will display "example" to the user
});
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/chain-middleware-to-create-a-time-server/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,21 @@
---
title: Get Data from POST Requests
---
## Get Data from POST Requests
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
Just like using req.query we can do req.body to get our data. This challenge is very similar to "Get Query Parameter Input from the Client."
In order to get data from a post request a general format is:
```javascript
app.post(PATH, function(req, res) {
// Handle the data in the request
});
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,20 @@
---
title: Get Query Parameter Input from the Client
---
## Get Query Parameter Input from the Client
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
Given the hint after the stub, "/name?first=<firstname>&last=<lastname>," we can build the response like so:
```javascript
app.get("/name", function(req, res) {
var firstName = req.query.first;
var lastName = req.query.last;
// Send the json object
});
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/get-query-parameter-input-from-the-client/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,21 @@
---
title: Get Route Parameter Input from the Client
---
## Get Route Parameter Input from the Client
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
If someone tells you to build a GET or POST you would do app.get(...) or app.post(...) accordingly. The basic structure of the challenge is:
```javascript
app.get("/:word/echo", function(req, res) {
// word = req.params.word;
// respond with the json object
});
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/get-route-parameter-input-from-the-client/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,28 @@
---
title: Implement a Root-Level Request Logger Middleware
---
## Implement a Root-Level Request Logger Middleware
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
It is easier to write this challenge all at the top (there is already a stub for it). This is because middleware must be placed the function calls you want it to be used for.
To set up your own middleware you can do it like so:
```javascript
app.use(function middleware(req, res, next) {
// Do something
// Call the next function in line:
next();
});
```
If you have trouble formatting the string correctly, one way to do it looks like:
```javascript
var string = req.method + ' ' + req.path + ' - ' + req.ip;
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/implement-a-root-level-request-logger-middleware/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,13 @@
---
title: Basic Node and Express
---
## Basic Node and Express
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/quadratic-equations/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->

View File

@@ -0,0 +1,21 @@
---
title: Meet the Node console
---
## Meet the Node console
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
Make sure you have cloned the correct repository/glitch project and are writing your code in myapp.js.
There are many methods available from the node console. You can find a list of these methods with Node.js documentation
<a href='https://nodejs.org/dist/latest-v10.x/docs/api/console.html' target='_blank' rel='nofollow'>here</a>. A common use would be to log errors such as:
```javascript
console.log("An error happened");
```
### If you use Glitch
- Glitch had changed the 'Logs' button to 'Status' button, still on the top-left, under the app name
- Don't submit the 'Edit' page directly. Click the 'Show' button (on top) and submit the application show page's url (url format is like https://appname.glitch.me/)

View File

@@ -0,0 +1,23 @@
---
title: Serve an HTML File
---
## Serve an HTML File
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
You probably need to comment out the last challenge. If you have a website and want to serve an index.html file you probably want to put this in a public folder. This is to ensure the public doesn't see something you dont want them to, and it sometimes is called "public" or "views," but you can technically call it whatever you want.
To serve an index.html in a folder called "public" at the root domain you would do so like this:
```javascript
app.get("/", function(req, res) {
res.sendFile( __dirname + "/public/index.html");
});
```
Note: __dirname returns the root directory is a best practice for node developers.
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/serve-an-html-file/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,20 @@
---
title: Serve JSON on a Specific Route
---
## Serve JSON on a Specific Route
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
It is rather simple to serve a json object with node (at the '/json' route), if we want to deliver a message and give it the value "Hello World," we can do so like this:
```javascript
app.get("/json", function(req, res) {
res.json({"message": "Hello World"});
});
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/serve-json-on-a-specific-route/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,23 @@
---
title: Serve Static Assets
---
## Serve Static Assets
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
Static webpages are fairly simple with express. This could be useful for building your own portfolio website or blog, etc.
To serve a static webpage from the "views" folder you can use code such as:
```javascript
const express = require("express");
const app = express();
app.use(express.static(__dirname + "/views"));
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/meet-the-node-console/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,30 @@
---
title: Start a Working Express Server
---
## Start a Working Express Server
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
If you had a website at "example.com/" and wanted to serve a string such as "Hello World" to whoever visits the root domain you could do so easily using node and/or express:
```javascript
app.get("/", function(req, res) {
res.send("Hello World");
});
```
Also, with ES6+ you can save some typing by using "=>" instead of "function," which looks like:
```javascript
app.get("/", (req, res) => {
res.send("Hello World");
});
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/start-a-working-express-server/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,17 @@
---
title: Use body-parser to Parse POST Requests
---
## Use body-parser to Parse POST Requests
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
The body-parser should already be added to your project if you used the provided boilerplate, but if not it should be there as:
```code
"dependencies": {
"body-parser": "^1.4.3",
...
```
You need to do for this challenge is pass the middleware to app.use(). Make sure it comes before the paths it needs to be used on.
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/use-body-parser-to-parse-post-requests/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,30 @@
---
title: Use the .env File
---
## Use the .env File
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
We can use the .toUpperCase() method to make a string all caps, such as:
```javascript
var response = "Hello World".toUpperCase(); // now becomes "HELLO WORLD"
```
All we need to do now is check what the value of the environment variable is, which you can do like:
```javascript
if (process.env.VAR_NAME === "allCaps") {
resonse = "Hello World".toUpperCase();
} else {
response = "Hello World";
}
});
```
<a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/basic-node-and-express/use-the-.env-file/index.md' target='_blank' rel='nofollow'>Help our community expand these hints and guides</a>.

View File

@@ -0,0 +1,13 @@
---
title: APIs and Microservices
---
## APIs and Microservices
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/quadratic-equations/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->

View File

@@ -0,0 +1,14 @@
---
title: Add a Description to Your package.json
---
## Add a Description to Your package.json
To complete the challenge follow the below steps:
* Go to the link given in the curriculam statring intro page.
![freecodecamp apis-and-microservices intro](https://user-images.githubusercontent.com/15084301/45616545-65732480-ba8d-11e8-9893-412ff6c68be5.png)
[Glitch starter project link](https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-npm)
* Edit the package.json file and update the author
* Then click on the show(your app) link at the top on the Glitch project to get the public link
![Glitch public project link](https://user-images.githubusercontent.com/15084301/45616579-8176c600-ba8d-11e8-8a46-4ac930578e74.png)
* Submit the link in the solution and that's it.
![sucess page](https://user-images.githubusercontent.com/15084301/45616757-019d2b80-ba8e-11e8-8b5b-98dc6d02c235.png)

View File

@@ -0,0 +1,10 @@
---
title: Add a License to Your package.json
---
## Add a License to Your package.json
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/add-a-license-to-your-package.json/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Add a Version to Your package.json
---
## Add a Version to Your package.json
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/add-a-version-to-your-package.json/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Add Keywords to Your package.json
---
## Add Keywords to Your package.json
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/add-keywords-to-your-package.json/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Expand Your Project with External Packages from npm
---
## Expand Your Project with External Packages from npm
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/expand-your-project-with-external-packages-from-npm/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: How to Use package.json, the Core of Any Node.js Project or npm Package
---
## How to Use package.json, the Core of Any Node.js Project or npm Package
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/how-to-use-package.json-the-core-of-any-node.js-project-or-npm-package/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,13 @@
---
title: Managing Packages with NPM
---
## Managing Packages with NPM
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/quadratic-equations/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->

View File

@@ -0,0 +1,10 @@
---
title: Manage npm Dependencies By Understanding Semantic Versioning
---
## Manage npm Dependencies By Understanding Semantic Versioning
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/manage-npm-dependencies-by-understanding-semantic-versioning/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Remove a Package from Your Dependencies
---
## Remove a Package from Your Dependencies
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/remove-a-package-from-your-dependencies/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Use the Caret-Character to Use the Latest Minor Version of a Dependency
---
## Use the Caret-Character to Use the Latest Minor Version of a Dependency
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/use-the-caret-character-to-use-the-latest-minor-version-of-a-dependency/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Use the Tilde-Character to Always Use the Latest Patch Version of a Dependency
---
## Use the Tilde-Character to Always Use the Latest Patch Version of a Dependency
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/managing-packages-with-npm/use-the-tilde-character-to-always-use-the-latest-patch-version-of-a-dependency/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,63 @@
---
title: Chain Search Query Helpers to Narrow Search Results
---
## Chain Search Query Helpers to Narrow Search Results
1. To create but not execut a find query
```javascript
Model.find( {name: 'Leah'} )
```
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
2. To store the find query into a variable for later use:
```javascript
var findQuery = YourModel.find( {name: 'Leah'} )
```
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3. To sort an array:<br>
```javascript
yourArray.sort( {age: 1} ) // Here: 1 for ascending order and -1 for descending order.
```
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
4. To limit an array's size:
```javascript
yourArray.limit(5) // return array which has 5 items in it.
```
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
5. To hide certain property from the result:
```javascript
yourArray.select( {name: 0, age: 1} ) // Here: 0 means false and thus hide name property; 1 means true so age property will show.
```
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
6. To exec this query, you can either:</br>
&nbsp;&nbsp;1) Callback:
```javascript
YourQuery.exec(function(err, docs) {
//do something here
})
```
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or 2) Promise
```javascript
YourQuery.exec.then(function(err, docs) {
//do something here
})
```
7. Chain it all together:
```javascript
Person.find({age: 55}).sort({name: -1}).limit(5).select( {favoriteFoods: 0} ).exec(function(error, people) {
//do something here
})
```
</br>
</br>
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Create a Model
---
## Create a Model
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/create-a-model/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Create and Save a Record of a Model
---
## Create and Save a Record of a Model
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/create-and-save-a-record-of-a-model/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Create Many Records with model.create()
---
## Create Many Records with model.create()
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/create-many-records-with-model.create/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Delete Many Documents with model.remove()
---
## Delete Many Documents with model.remove()
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/delete-many-documents-with-model.remove/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Delete One Document Using model.findByIdAndRemove
---
## Delete One Document Using model.findByIdAndRemove
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/delete-one-document-using-model.findbyidandremove/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,13 @@
---
title: MongoDB and Mongoose
---
## MongoDB and Mongoose
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/quadratic-equations/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
#### More Information:
<!-- Please add any articles you think might be helpful to read before writing the article -->

View File

@@ -0,0 +1,14 @@
---
title: Install and Set Up Mongoose
---
## Install and Set Up Mongoose
You might want to check both the [MongoDB](https://www.npmjs.com/package/mongodb) and the [Mongoose](https://www.npmjs.com/package/mongoose) NPM Repositories to get up and running.
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/install-and-set-up-mongoose/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Perform Classic Updates by Running Find, Edit, then Save
---
## Perform Classic Updates by Running Find, Edit, then Save
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/perform-classic-updates-by-running-find-edit-then-save/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Perform New Updates on a Document Using model.findOneAndUpdate()
---
## Perform New Updates on a Document Using model.findOneAndUpdate()
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Use model.find() to Search Your Database
---
## Use model.find() to Search Your Database
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-database/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Use model.findById() to Search Your Database By _id
---
## Use model.findById() to Search Your Database By _id
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findbyid-to-search-your-database-by-id/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->

View File

@@ -0,0 +1,10 @@
---
title: Use model.findOne() to Return a Single Matching Document from Your Database
---
## Use model.findOne() to Return a Single Matching Document from Your Database
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/apis-and-microservices/mongodb-and-mongoose/use-model.findone-to-return-a-single-matching-document-from-your-database/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->