deno.land / x / mongoose@6.7.5 / benchmarks / create.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// require('nodetime').profile();
'use strict';
const mongoose = require('../../mongoose');const Benchmark = require('benchmark');
const Schema = mongoose.Schema;
const CheckItem = new Schema({ name: { type: String }, type: { type: String }, pos: { type: Number }});
const Checklist = new Schema({ name: { type: String }, checkItems: { type: [CheckItem] }});
const Board = new Schema({ checklists: { type: [Checklist] }});
const BoardModel = mongoose.model('Board', Board);const CheckItemModel = mongoose.model('CheckItem', CheckItem);const doc = require('./bigboard.json');
new Benchmark.Suite() .add('CheckItem', function() { new CheckItemModel({ _id: '4daee8a2aae47fe55305eabf', pos: 32768, type: 'check', name: 'delete checklists' }); }) .add('Board', function() { new BoardModel(doc); }) .on('cycle', function(evt) { if (process.env.MONGOOSE_DEV || process.env.PULL_REQUEST) { console.log(String(evt.target)); } }) .run();
mongoose

Version Info

Tagged at
a year ago