Write mongoDB query for inserting document with ObjectId created from hexadecimal string.
Collection Name: students
Insert below document in collection student. And use hexadecimal 602e693f7e8df9001191c1a1 for objectid creation.
[
{
name: 'Joe Rogan',
age: 35,
country: 'USA'
}
]
To learn more about ObjectId and createFromHexString() : ObjectId.createFromHexString().
db.students.insertOne({
_id:ObjectId.createFromHexString('602e693f7e8df9001191c1a1'),
name: 'Joe Rogan',
age: 35,
country: 'USA',
})