Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Automattic/mongoose
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jul 5, 2022
2 parents 04966eb + cba16b9 commit 81c410a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
26 changes: 13 additions & 13 deletions benchmarks/benchjs/casting.js
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
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
5 changes: 3 additions & 2 deletions docs/schematypes.md
Expand Up @@ -279,8 +279,9 @@ const schema2 = new Schema({

<h5>Date</h5>

* `min`: Date
* `max`: Date
* `min`: Date, creates a [validator](./validation.html) that checks if the value is greater than or equal to the given minimum.
* `max`: Date, creates a [validator](./validation.html) that checks if the value is less than or equal to the given maximum.
* `expires`: Number or String, creates a TTL index with the value expressed in seconds.

<h5>ObjectId</h5>

Expand Down

0 comments on commit 81c410a

Please sign in to comment.