Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix benchmark #12055

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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