Test | 10e7 documents | 10e8 documents | 10e9 documents |
---|---|---|---|
Bulk insert | 206 s | 2029 s | 20687 s |
Indices | 55 s | 592 s | 6157 s |
Disk space | ~ 260 MB | ~ 2.6 GB | ~ 26 GB |
Memory space | ~ 3 GB | ~ 6 GB | all |
Max request | 7 s | 78 s | 1192 s |
Greater request | 0.013 s | 0.025 s | 0.166 s |
ID request | < 1ms | < 1ms | 0.024 s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mongodb from 'mongodb' | |
import mongoManager from 'feathers-mongodb-management' | |
// Connect to the DB at startup | |
app.db = await mongodb.connect(app.get('dbUrl')) | |
// Create the service to manage DBs | |
app.use('/databases', mongoManager.database({ db: app.db }) | |
... | |
// Hooks to manage DB linked to an organisation | |
function createOrganisationDB (hook) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import service from 'feathers-mongodb' | |
function createOrganisationService (hook) { | |
let organisationDb = app.db.db(hook.result._id.toString()) | |
app.use(hook.result._id.toString() + '/assets', service({ | |
Model: organisationDb.collection('assets') | |
}) | |
return hook | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { merge } from 'feathers-commons' | |
function createProxyService (options) { | |
const targetService = options.service | |
function proxy (params) { | |
return merge(params, options.params) | |
} | |
return { | |
find (params) { return targetService.find(proxy(params)) }, | |
get (id, params) { return targetService.get(id, proxy(params)) }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Permissions = { | |
member: 0, | |
manager: 1, | |
owner: 2 | |
} | |
const Scopes = ['organisations', ...] | |
// Construct abilities for a given subject on a resource based on its permissions | |
function defineResourceRules (subject, resource, resourceService, can) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
function defineAbilitiesForSubject (subject) { | |
const { rules, can, cannot } = AbilityBuilder.extract() | |
// Run registered hooks | |
hooks.forEach(hook => hook(subject, can, cannot)) | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db = db.getSiblingDB('random'); | |
var minDate = new Date(2012, 0, 1, 0, 0, 0, 0); | |
var maxDate = new Date(2013, 0, 1, 0, 0, 0, 0); | |
var delta = maxDate.getTime() - minDate.getTime(); | |
var documentNumber = arg1; | |
var batchNumber = 1000; | |
var start = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db = db.getSiblingDB('random'); | |
var start = new Date(); | |
printjson(db.randomData.aggregate([ { $group : { _id: null, max: { $max : "$value" }}} ], {allowDiskUse: true}).toArray()); | |
print('Find maximum value in ' + (new Date() - start)/1000.0 + 's'); | |
start = new Date(); | |
printjson(db.randomData.find( { value: { $gt: 99.9 } } ).sort({ value: -1}).limit(100).toArray()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 8, | |
"name": "OSM Bright", | |
"metadata": { | |
"mapbox:type": "template", | |
"mapbox:groups": { | |
"1444849364238.8171": { | |
"collapsed": false, | |
"name": "Buildings" | |
}, |
OlderNewer