Skip to content

Commit

Permalink
Merge pull request #12055 from lpizzinidev/fix-benchjs-4
Browse files Browse the repository at this point in the history
fix benchmark
  • Loading branch information
Uzlopak committed Jul 5, 2022
2 parents be859ed + 499f499 commit f947c20
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions benchmarks/benchjs/casting.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Comments.add({
title: String,
date: Date,
body: String,
comments: [Comments]
comments: [Comments],
});

const BlogPost = new Schema({
Expand All @@ -34,7 +34,7 @@ const BlogPost = new Schema({
date: Date,
meta: {
date: Date,
visitors: Number
visitors: Number,
},
published: Boolean,
mixed: {},
Expand All @@ -44,15 +44,15 @@ const BlogPost = new Schema({
comments: [Comments],
def: {
type: String,
default: 'kandinsky'
}
default: 'kandinsky',
},
});

const commentData = {
title: 'test comment',
date: new Date(),
body: 'this be some crazzzyyyyy text that would go in a comment',
comments: [{ title: 'second level', date: new Date(), body: 'texttt' }]
comments: [{ title: 'second level', date: new Date(), body: 'texttt' }],
};

const blogData = {
Expand All @@ -62,16 +62,16 @@ const blogData = {
date: new Date(),
meta: {
date: new Date(),
visitors: 9001
visitors: 9001,
},
published: true,
mixed: {
thisIsRandom: true
thisIsRandom: true,
},
numbers: [1, 2, 7, 10, 23432],
tags: ['test', 'BENCH', 'things', 'more things'],
def: 'THANGS!!!',
comments: []
comments: [],
};

const blogData10 = utils.clone(blogData);
Expand Down Expand Up @@ -100,35 +100,35 @@ suite
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData);
}
},
})
.add('Casting - Embedded Docs - 10 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData10);
}
},
})
.add('Casting - Embedded Docs - 100 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData100);
}
},
})
.add('Casting - Embedded Docs - 1000 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData1000);
}
},
})
.add('Casting - Embedded Docs - 10000 Docs', {
fn: function () {
const BlogPost = mongoose.model('BlogPost');
const bp = new BlogPost();
bp.init(blogData10000);
}
},
})
.on('cycle', function (evt) {
if (process.env.MONGOOSE_DEV || process.env.PULL_REQUEST) {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchjs/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ mongoose.connect('mongodb://localhost/mongoose-bench', function (err) {
nData.likes = data.likes;
nData.address = data.address;
user.insertOne(nData, function (err, res) {
dIds.push(res.insertedIds);
dIds.push(res.insertedId);
--count || next();
});
}
Expand Down

0 comments on commit f947c20

Please sign in to comment.