mkrogemann / couchdb_connector Goto Github PK
View Code? Open in Web Editor NEWA couchdb connector for Elixir
License: Apache License 2.0
A couchdb connector for Elixir
License: Apache License 2.0
I have a view which has sorted phone numbers, keys with "+" don't work. Should the connector provide URLescaping of parameters by default?
This doesn't work: It returns 0 results.
{:ok, result} = Couchdb.Connector.View.document_by_key(db, "test_queries", "by_phone_number", "+358123456789")
GET /test_users/_design/test_queries/_view/by_phone_number?key="+358123456789"&stale=update_after 200
This works:
{:ok, result} = Couchdb.Connector.View.document_by_key(db, "test_queries", "by_phone_number", "%2B358123456789")
GET /test_users/_design/test_queries/_view/by_phone_number?key="%2B358123456789"&stale=update_after 200
I noticed that it's only possible to pass json strings to the writer.
I also see that the json is parsed into a map for some sanitation.
I think it makes sense to allow maps to be passed into the create method to save back and forth parsing.
These will proxy out to the correspondent functions in the writer module
implement wrappers to take / return Maps instead of JSON strings only
Write two update functions that accept Maps, one with authentication, one without.
also known as Basic Auth
We should be able to delete documents
When I use a view with an integer key, the function document_by_key
doesn't work.
{:ok, body} = document_by_key(@db_props, %{design: "user", view: "by_s_id", key: Integer.to_string(s_id)}, :ok)
resulted in an empty list.
The url created by unauthenticated_document_by_key
is like this
http://localhost:5984/db_dev/_design/user/_view/by_s_id?key=\"18155059\"&stale=ok
In the terminal I played with some queries.
curl -X GET http://localhost:5984/db_dev/_design/user/_view/by_s_id?key=\"18155059\"&stale=ok
Don't work. Result rows = empty list
curl -X GET http://localhost:5984/db_dev/_design/user/_view/by_s_id?key="18155059"&stale=ok
curl -X GET http://localhost:5984/db_dev/_design/user/_view/by_s_id?key=18155059&stale=ok
Both work. rows = One result.
I started this month with Elixir and I don't know if I do something wrong.
I have written a function document_by_int_key
. This create in query_int_path
key=18155059
and not key=\"18155059\"
for the url
After #38 there is a lot of deprecated code.
I personally would like to remove all deprecated functions. I don't know what the general opinion is.
I understand the backwards compatibility will break, but ultimately it will make the code a lot cleaner.
coverex has issues. let's try if this alternative works
Hi, I'm trying to use the query parameters skip
and limit
to paginate an output, did you implement them in any way?
Example:
http://localhost:5984/db/_design/d/_view/random?skip=i&limit=1
I noticed there is no way to create a database with basic authentication.
This is necessary when you can't access you database on localhost (docker is a typical example).
Would you merge a PR if I provided one?
Happens rarely on local developer workstation. Quite often on Travis CI VMs.
Allowing parameters to be included at the end of a URL would allow much more flexibility for views in particular. One clear benefit would be allowing linked documents with the use of the include_docs
parameter.
In order to save handshake time, implement connection pooling and keep http connections alive
Should allow at least adding attachments to existing documents. Scope is deliberately limited as the topic seems to be huge.
Documentation is given in many places :-|
Here are some pointers.
https://elegantcode.com/2009/07/10/adding-attachments-to-documents-in-couchdb/
https://wiki.apache.org/couchdb/HTTP_Document_API#Attachments
http://docs.couchdb.org/en/2.0.0/api/document/attachments.html?highlight=attachment
http://guide.couchdb.org/draft/api.html#attachments
http://docs.couchdb.org/en/1.6.1/api/document/common.html#creating-multiple-attachments
http://docs.couchdb.org/en/1.6.1/api/document/attachments.html#http-range-requests
Hey Markus!
I was looking for a way to use couchdb with phoenix to create a clustered (phoenix) and db synced (couchdb) API backend.
However doing rest calls with basic auth every time is not secure.
Is there a chance you would have time to look into cookie + oauth2 auth for this?
What do you think is the effort?
Anything I can do to help?
Where could I start looking in your code to expand on this?
Thank you!
In order to save handshake time, implement connection pooling and keep http connections alive
Hi there,
it seems that I can't do Couchdb.Connector.Writer.create(db_props, "{"key": "value"}") as Couchdb.Connector.Writer.create/2 is undefined. Only Couchdb.Connector.Writer.create/3 is available. What if I don't want to pass an id?
Thanks for your reply,
Didier
admin users are special and require the use of a dedicated API
configure hackney pool for connections to CouchDB.
see edgurgel/httpoison#73 for inspiration
requires OTP supervisor/worker configuration (see #3 )
stacktrace of a failed test
Favour the proxies in couchdb_connector
I have code ready for the dev branch (soon) that handles attachments. I am meticulously going through tests and fixing bugs.
Writer.couchdb_safe/1 is used as a guard against erratic client requests with contradicting id's. This creates overhead, esp. when clients pass in Maps to start with.
In order to enable authentication, we want to support functions to create users, change passwords etc.
in order to build supervision tree for connection pool and other worker processes
Admin.set_security should be enhanced to cater for individual user roles
When running 'mix deps.get' I get this error:
Running dependency resolution
Conflict on poison 2.1.0
mix.lock: 2.1.0
couchdb_connector 0.2.0: ~> 1.5.0
phoenix 1.1.4: ~> 1.5 or ~> 2.0
** (Mix) Hex dependency resolution failed, relax the version requirements or unlock dependencies
How do I solve this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.