Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boly38/mongo-scripts
various mongodb scripts
https://github.com/boly38/mongo-scripts
hacktoberfest mongodb script utility
Last synced: 17 days ago
JSON representation
various mongodb scripts
- Host: GitHub
- URL: https://github.com/boly38/mongo-scripts
- Owner: boly38
- Created: 2019-03-26T13:41:52.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2023-09-05T14:30:28.000Z (over 1 year ago)
- Last Synced: 2024-10-17T16:06:14.891Z (4 months ago)
- Topics: hacktoberfest, mongodb, script, utility
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Mongo Scripts
=============## Description
This repository provide various mongoDB scripts.
## `minMax/` field length
Original idea : [post SO - govin answer](https://stackoverflow.com/questions/26395422/how-to-find-longest-and-shortest-length-of-a-value-for-a-field-in-mongodb)
- [`minMaxFunctions.js`](./minMax/minMaxFunctions.js) : functions to check min and max length of some field.
- [`example.js`](./minMax/example.js) : sample usage## Quick example
```shell
$ mongo.exe --host localhost --port 27017 < minMax/example.js
MongoDB shell version (...)
Work on db: mongo-script-test
switched to db mongo-script-test
Load REQUIREMENT : minMaxFunctions.js
true
* reset myuser data
true
WriteResult({ "nInserted" : 1 })
WriteResult({ "nInserted" : 1 })
* start myuser data analysis
myuser
myuser.count: 2
myuser [name].length - min: 3 max: 6
myuser [info].keys.length - min:2 max:3
myuser [info][country].length - min: 2 max: 3
myuser [info.children][].length - min:1 max:3
myuser [info.children][*][name].length - min:3 max:30
myuser [tags].keys.length - min:1 max:3
myuser [tags](keys).length - min:1 max:3
myuser [tags](k).length - min:2 max:16
myuser [comments].length - min: 5 max: 180
myuser [comments][].length - min: 0 max: 2
myuser [comments][*][text].length - min: 14 max: 24
myuser [comments][userId] is missing
myuser [comments][].length - min:0 max:2
myuser [comments][*][userIDENTITY.name].length - min:1 max:14
myuser [properties].keys.length - min:2 max:2
myuser [properties](keys).length - min:2 max:2
myuser [properties](k,v).length - minK:3 maxK:5 minV:1 maxV:6
myuser [myBinary].length - min: 16 max: 16
bye
```