I want to connect mongoDb with react.
My need is: I have to store my sass variable in mongoDb and than fetch them in my sass via mongoDb.
How can I do that?
You, unfortunately, can't
This is the standard setup for web applications
frontend --> backend --> db
With your current setup its:
frontend --> db
You must have a backend to access the db
----------------------------------
React being our frontend, you must have a backend if you would like to use MongoDB
Ruby on Rails, Django, Meteor.js, Express.js, Golang Gin, etc
Related
Currently, I'm developing a native application using React-Native. I've decided to go with AWS Amplify because of it's real time updates as well as its authentication.
I also have a Web Application that runs on a Node.js with Epxress server. This web application connects to a Mongo database.
My big problem is that I would like to have all of my aws amplify queries run to my existing MongoDb instead of a new dynamoDb database which is provided with AWS AppSync, but unfortunately I dont know where to start. This is especially helpful in adding authentication easily in my existing web application as well.
My first idea was to just create all my API endpoints in a new node js server and have app sync call to these API end points, but I'm not sure how to implement calling end points on an existing server (and this seems kind of counter intuitive to the 'serverless' idea)
My other idea came from this: Can AWS App-Sync be used without dynamoDB
This states to use AWS Lambda to 'pipeline' my data to the existing mongodb, but I'm not really sure what that entails.
TL;DR - I would like to be able to query an existing Mongodb instead of using DynamoDb when using AWS Amplify with AppSync.
I hope this is clear enough and doesn't sound like I'm rambling. Thanks in advance!
I would suggest using either an HTTP datasource to connect to your MongoDB backend or a Lambda function. Here are a couple getting started tutorials for both:
https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-http-resolvers.html
https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html
If you go the Lambda route, then you can leverage the new #function feature of the GraphQL Transformer in the Amplify CLI: https://aws-amplify.github.io/docs/cli/graphql#function
i am trying to use mongodb in my phoenix application. however the official documentation refers to only RDBMS (postgresql). is there a way to connect to mongodb with phoenix framework 1.4.
i am trying to build an application in phoenix which will have unstructured data. i see from the documentation of ECTO mongodb for old version. for 1.4 version of the phoenix, there is no option specified.
There does not appear to be a MongoDB/Ecto integration that is up to date with Ecto 3 yet.
But Phoenix is not your application, it is an interface. It provides the web interface. You can have other things in your application apart from Phoenix, and you can wrap MongoDB in a way that your Phoenix-based-interface can consume the data.
So the answer to your question is yes there is a way to connect MongoDB with Phoenix 1.4 but it is not plug-and-play.
Edit: I threw (emphasis on threw) together an example which can be found here
Basically it involves two applications: one a stock elixir application that is just mongodb 0.4.7 and wraps some functions. The other is a phoenix app that uses the aforementioned mongodb wrapper app. The Phoenix App needs to be created with mix phx.new --no-ecto, ostensibly you could do this as one app, but this gives you a bit more leeway.
Using the MongoDB in Phoenix is very simple. You don't need to use the Ecto stuff, because it is designed for relational database like PostgreSQL. You talk directly to the mongodb driver:
You can put the connection url into the config environment (config.ex, for example) of your Phoenix app:
config :app, :mongodb,
url: "mongodb://localhost:27017,localhost:27018,localhost:27019/my_database?replicaSet=my_replica_set"
The URL specifies a replica set of three nodes.
In application.ex you add a worker like this:
old style:
worker(Mongo, [[name: :mongo, url: Application.get_env(:app, :mongodb)[:url], timeout: 60_000, pool_size: 10]])
need style:
{Mongo, [name: :mongo, url: Application.get_env(:app, :mongodb)[:url], timeout: 60_000, pool_size: 10]}
The worker starts the GenServer with a timeout of 60 seconds and a pool size of 10 connection. After that you can use the MongoDB as usually:
Mongo.find(:mongo, "accounts", %{"email" => the_email})
How can KeystoneJS be used to implement multi-tenancy? Is it possible at all?
Example use case: A company is creating a new blog platform using KeystoneJS and it wants to allow for multiple blog sites using the same models from one KeystoneJS instance but each blogger should only be able to control their own site.
Keystonejs does not really support this. Something that you could do, however, is to use something like Docker with an image of the Keystonejs website, then add some configuration to give each instance a different db path.
Or Spring up multiple Node Servers, something like this:
// Keystone 1
process.env.PORT=3000
// Keystone 2
process.env.PORT=3001
// ...
and Spring up one MongoDB server, and assign a unique database name to each node server / keystone instance, like
// Keystone 1: .env
MONGO_URI=mongodb://localhost:27017/KT_1
// Keystone 2: .env
MONGO_URI=mongodb://localhost:27017/KT_2
More info, check out Connection String URI Format[mongodb]
I like only use docker to spring up a MongoDB server and run Keystone locally since Docker works quite tricky with node.js.
I need little help for connect my front end angular2 with MongoDB
I have created a form crud and need connect with database MongoDB
Any Idea?
You can not connect Angular2 directly to MongoDB you need to use NodeJs also. There is a course on Udemy which is called Angular2 & Node - The Prectical Guide MEAN Stack. It may help you.
You can connect MongoDB with Angular Application using NodeJs and Express .
You'll need to set up a server with which you'll have to configure your port , etc .
Later you can coonect to your MongoDb either using Mongoose or MongoJs .
How do I add new Database support (MongoDB) in 2.6.3 version of WSO2 Data Service Server.
You can use DSS (2.6.3) with any database type if the database connectivity is exposed via JDBC. In other words, if your preferred database type exposes a JDBC driver/adapter for the users to connect to it via JDBC then you can use DSS to expose your data stored in your data store as a web service. Similarly, if MongoDB too has a JDBC adapter you wouldn't have any (or too many :) ) issues integrating that with DSS. However, there are some exceptions when it comes to exposing flat files such as google spreadsheeets, excel sheets, csv files as DSS uses the relevant client APIs such as Google gdate client API, Apache POI, etc to connect to those datasources and extract data. However, if we consider the general case is you need to have an adapter or a similar mechanism to connect to your datasource via JDBC.
But in the upcoming version of DSS (v3.0.0), it is planned to introduce custom datasource support so you can easily write an adapter to any datasource and use it with DSS.
Regards,
Prabath
I am not sure about this, but I suppose that if is not supported by default you can always download the jar library for MongoDB and put it in CARBON_HOME\repository\components\lib and restart. For example for mysql I have the mysql-connector-java-5.1.7-bin.jar in that folder.
Hope this help