Hi, does Realm allow pushing a single function to Realm? I’m accustomed to writing code in VS Code, but it seems that I can only push the entire app to Realm. This could potentially overwrite functions that have been modified by other team members.
Seeing your previous question, on this forum it appears you may be confusing the Atlas UI with the Atlas CLI, when in reality both provide the ability to modify the same underlying Atlas App which is essentially a series of special directories/files that Realm uses for its various roles. The Atlas UI will show the Realm App in a browser-viewable interface, but it is also possible to also modify the filesystem of the Realm App and push the directory up to Atlas using the Realm CLI. You view steps for downloading the CLI onto your machine here.
Follow the steps below to
- Pull the current Realm app using
realm-cli pull <your_realm_app_id>,
- Open the root folder in VSCode,
- Add your function to a new file within the functions subdirectory and
realm-cli push --remote=<your_realm_app_id> --to update the existing Realm app with the new function. Once you do this, you will see the changes in realm.
Check out the following page from the Atlas App Documentation for more details on updating Realm Apps from the CLI.
Thank you for your response, and I apologize for the confusion earlier. My concern is that I seem to only have the option to push all the functions in a batch, rather than updating a single function individually. While pushing all functions is not a problem in itself, there are scenarios where I would prefer to push just one function. Additionally, my colleagues might be working on different functions, so it would be more convenient if I could update a single function at a time.
But for now, push all the functions is enough for me.
Just following up here. It looks like selective pushes to realm is an open feature request according to this thread. However, if you would really like to have stronger version control, you may want to use git on a remote repository in order to reconcile changes between your team, and then pull/push the repo using the Realm CLI when ready for deployment. That would also give you more control over the specific files in each commit, which appears to be what you are interested in.
Got it, many thanks.
As of my last knowledge update in September 2021, MongoDB Realm allows you to use the
realm-cli to deploy various components of your application, including functions. However, the
realm-cli primarily deals with deployment tasks and doesn’t have the capability to analyze the content or keywords within your functions.
To deploy a single function using the
realm-cli, you generally follow these steps:
realm-cli: You need to have the
realm-cliinstalled on your machine. You can install it using npm (Node Package Manager):
npm install -g mongodb-realm-cli
- Login: You need to authenticate with your MongoDB Realm account using the following command and follow the prompts:
- Create or Select Your App: If you’re working with an existing Realm app, you can select it using:
If you’re creating a new app, you can use:
realm-cli apps create
Deploy the Function: Use the
realm-clito deploy your function:
realm-cli push --path /path/to/your/function
/path/to/your/function with the actual path to your function’s source code.
Remember that the
realm-cli doesn’t analyze the content of your function or look for specific keywords like “online earning.” It’s designed to manage deployment tasks and configurations for your MongoDB Realm app.
If you’re looking to implement a function related to “online earning,” you would need to write the function code yourself and make sure it adheres to MongoDB Realm’s function requirements. The
realm-cli will then help you deploy this function to your Realm app.
Keep in mind that the tools and features provided by platforms like MongoDB Realm might have evolved since my last update in September 2021. I recommend checking the official MongoDB Realm documentation or resources for the most up-to-date information on using the
realm-cli and its capabilities.
Thank you for your reply. I’ve just checked the document, and I didn’t find the
--path option. It seems it’s not a valid option for the
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.