return value
If there is no return value, an error will be thrown and an error message will be output. By getLastErrMsg you get an error message, or by getLastError to get the error code. For error handling, please refer to the common error handling guide .
error
The error information is recorded in the node diagnosis log (diaglog), and you can refer to the error code .
Example
Separate a node from group1 and add it to group2 as follows:
Node information before attachNode:
db.listReplicaGroups()
{
"Group": [
{
"HostName": "hostname1",
"Status": 1,
"dbpath": "/opt/sequoiadb/database/data/11830/",
"Service": [
{
"Type": 0,
"Name": "11830"
},
{
"Type": 1,
"Name": "11831"
},
{
"Type": 2,
"Name": "11832"
}
],
"NodeID": 1007
}
......
],
"GroupID": 1002,
"GroupName": "group1",
"PrimaryNode": 1002,
"Role": 0,
"Status": 1,
"Version": 7,
"_id": {
"$oid": "580adfd531ae32109e38ca29"
}
}
......
{
"Group": [
{
"HostName": "hostname2",
"Status": 1,
"dbpath": "/opt/sequoiadb/database/data/11840/",
"Service": [
{
"Type": 0,
"Name": "11840"
},
{
"Type": 1,
"Name": "11841"
},
{
"Type": 2,
"Name": "11842"
}
],
"NodeID": 1000
}
......
],
"GroupID": 1000,
"GroupName": "group2",
"PrimaryNode": 1000,
"Role": 0,
"Status": 1,
"Version": 7,
"_id": {
"$oid": "580adfd531ae32109e38ca27"
}
}
Click on Jushan Database Documentation Center for more information