Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mongodb-orders
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
joel.vonderwe
mongodb-orders
Commits
7034c5ad
Commit
7034c5ad
authored
6 years ago
by
joel.vonderwe
Browse files
Options
Downloads
Patches
Plain Diff
Ended TP3
parent
94ccc733
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+12
-12
12 additions, 12 deletions
README.md
with
12 additions
and
12 deletions
README.md
+
12
−
12
View file @
7034c5ad
...
...
@@ -14,26 +14,26 @@ You have two options for the HTTP API:
build and run MongoDB and Node.js API with
`orders.json`
dump:
```
```
bash
docker-compose up
--build
-d
```
if you encounter any problem (no order db), run
`mongo-seed`
first :
```
```
bash
docker-compose up
--build
-d
mongo-seed
docker-compose up
-d
```
use mongodb (mongo shell):
```
```
bash
docker-compose
exec
mongo-orders mongo admin
```
### Option 2 (mongo and node containerized)
```
js
```
bash
docker-compose
-f
docker-compose-with-node.yml up
--build
-d
```
...
...
@@ -72,7 +72,7 @@ db.orders.find().map( obj => obj.vendors );
### Using node locally (option 1)
```
js
```
bash
cd
api
npm
install
npm start
...
...
@@ -108,41 +108,41 @@ API already available at http://localhost:8080/by-customer-pseudo/A**D
### requête 1
```
js
db
.
orders
.
find
({
"
shipping.bags
"
:
2
}).
pretty
();
```
### requête 2
```
js
db
.
orders
.
find
({
"
vendors.slug
"
:
"
les-fromages-de-gaetan
"
}).
pretty
();
```
### requête 3
```
js
db
.
orders
.
find
({
"
shipping.bags
"
:
{
"
$gt
"
:
4
}}).
count
();
```
### requête 4
```
js
db
.
orders
.
distinct
(
"
customer.pseudo
"
,
{
"
shipping.bags
"
:
{
"
$gte
"
:
4
}});
```
### requête 5
```
js
db
.
orders
.
find
({
"
customer.id
"
:
NumberLong
(
1848533681975648
)}).
pretty
();
```
### requête 6
```
js
db
.
orders
.
aggregate
({
$group
:
{
_id
:
{
"
id
"
:
"
$customer.id
"
,
"
pseudo
"
:
"
$customer.pseudo
"
},
count
:
{
$sum
:
1
}}})
```
### requête 7
```
js
db
.
orders
.
aggregate
({
$unwind
:
"
$items
"
},
{
$group
:
{
_id
:
{
"
slug
"
:
"
$items.vendor
"
},
sales
:
{
$sum
:
"
$items.finalprice
"
}}}).
pretty
();
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment