We can see now that the user has no data for level 1. We'll first check if the user has any data for level 1: ".LogEventRequest",
tScriptData( "data", partialResult) Įxecution of the Configuration Register a User to Use for the Tests ".RegistrationRequest",
Run the aggregation var partialResult = progressCollection.aggregate(matchObject, projectObject) We need to create JSON object using a string as a key //We do this using the notation var updateObject = Get the value that was passed in for VAL var inputValue = Spark. Get the value that was passed in for PATH var inputPath = Spark. This script uses a little bit of Mongo magic to create the document if it doesn't already exist, and sets the value you want at the path you ask for: var progressCollection = ntimeCollection( "player_progress")
We now need to bind a Cloud Code script to this Event to access the data and make the document updates.
We'll add a new Event in the portal that looks like this:Ĭreating the Script to Process the Update Event If this sounds a little complex, bear with us and work through the example - it should all become clear by the time you've work through the example! This Event will contain the path of the document we want to update and the value we want to set at that path. We're creating a generic Event for updating a document. Configuring the Game Creating the Event for Updating the Document.
More Information! For further details and recommendations on how to use MongoDB collections to store and manage your game data, see the Managing Data Persistence tutorial. In this state, the document we store against the user will look like this:
Json_model interact with database and stored json string into database. It shows the form page where user can enter and submit employee data.Ĭonvert CodeIgniter Query to Json & Insert Into DatabaseĮcho form_dropdown('select', $data_gender, 'Male', 'class="dropdown_box"') $data = 'Please configure your database correctly'
$data = 'Json data successfully inserted into database !' $return = $this->json_model->insert_json_in_db($json_data) 'employee_gender' => $this->input->post('select'), 'employee_email' => $this->input->post('emp_email'), 'employee_name' => $this->input->post('emp_name'), Fetch user data and convert data into json