In my project I was inserting a project into a database and I need to assign the "id" created when project is inserted into database.
r.db("DatabaseName").table("TableName").insert("Values")
{
"deleted": 0 ,
"errors": 0 ,
"generated_keys": [
"6538d988-f8e8-4ab0-bf71-f363fce91b9f"
] ,
"inserted": 1 ,
"replaced": 0 ,
"skipped": 0 ,
"unchanged": 0
}
The query to insert will provide a response as shown above and we can make use of the generated_keys to use for our purpose.
The database used is rethinkdb and query is written in reql language.
r.db("DatabaseName").table("TableName").insert("Values")
{
"deleted": 0 ,
"errors": 0 ,
"generated_keys": [
"6538d988-f8e8-4ab0-bf71-f363fce91b9f"
] ,
"inserted": 1 ,
"replaced": 0 ,
"skipped": 0 ,
"unchanged": 0
}
The query to insert will provide a response as shown above and we can make use of the generated_keys to use for our purpose.
The database used is rethinkdb and query is written in reql language.
No comments:
Post a Comment