We have requirement to execute replaceOne operation with db.runCommand()
I checked list of commands from here, but i haven't found any command to replace one document.
Can someone please suggest us whether this is possible or not?
We have requirement to execute replaceOne operation with db.runCommand()
I checked list of commands from here, but i haven't found any command to replace one document.
Can someone please suggest us whether this is possible or not?
We can use update command to replace one document. Refer update for more details.
Sample replace command
{
'update': 'collectionName',
'updates': [
{
'q': {
'age': '33'
},
'u': {
'status': 'pass',
'company': 'AK'
}
}
]
}
Refer update-with-a-replacement-document for more details