Hello everyone, how are you?
I am starting my studies in MongoDB and at first I really like to practice CRUD operations interacting via shell.
I would like to know if it is possible to change the position of a simple “field: value” in a given collection, as shown below:
db.movies.find({"_id": ObjectId("5ed07711b61249708c74f684")}).pretty()...
{
"_id" : ObjectId("5ed07711b61249708c74f684"),
"item" : "movie",
"year" : 2013,
"cats" : "Donni Yen",
"trilogy" : true,
**"title" : "Yip Man"**
}
I wanted to move “title”: “Yip Man” to position 2:
{
"_id" : ObjectId("5ed07711b61249708c74f684"),
"item" : "movie",
**"title" : "Yip Man"**,
"year" : 2013,
"cats" : "Donni Yen",
"trilogy" : true
}
I’ve been researching a lot but I couldn’t find this specific issue.
Thank you very much if you can help me.