As parameters to the query. Depends what you use to query CouchDB.
As an http request, it would look something like:
http://host:5984/{dbname}/_design/{design_doc}/_view/{view}?startkey='412918563004231700'&endkey='412918563004231700'&include_docs=true
If you use a wrapper, like nano for node.js, you can add the keys to the
query
------------------------------------------------------------------------
*best regards,*
Kiril Stankov,
On 05-Mar-15 12:23 AM, Ayhan Kesenci wrote:
where i put startkey and endkey andrew ??
2015-03-04 19:51 GMT+01:00 Andrew Koster <[email protected]>:
There does not seem to be much difference between your method and Jonas's
solution. However, if all you need is to get the document with
include_docs, for the sake of optimality, you can just emit(null, null)
instead of doing that extra string comparison. Additionally, you can
emit(null, doc) and do away with ?include_docs=true.
If you are really sure you will only ever need it with that specific ID,
then that solution will work, but in case you want to make it more general
(allow it to search for ANY document id, you can use the view:
function(doc) { emit(doc.id, null); }
and then query it with
?startkey='412918563004231700'&endkey='412918563004231700'
Wrap this in a more user friendly page/function and you have a nice and
generic solution.
Cheers,
Andrew
-----Original Message-----
From: Ayhan Kesenci [mailto:[email protected]]
Sent: 04 March 2015 15:15
To: [email protected]; [email protected]
Subject: Re: Seachring specific Word in couchdb
Okay this works but i get again more than I want , but thank you, so i
try this function (doc) { if (doc.id == '412918563004231700'); { emit(
doc.id == '412918563004231700', null); }}
so i get a true or false, than i let it sort by true, so i can identify
the file that i need, thank you jonas :)
2015-03-04 19:08 GMT+01:00 Jonas Weber <[email protected]>:
So sorry, I forgot an } at the end (I always do).
On 4 March 2015, Ayhan Kesenci <[email protected]> wrote:
Get an Error Message, does not evaluate.
Ayhan
2015-03-04 18:59 GMT+01:00 Jonas Weber <[email protected]>:
Hi Ayhan,
does function (doc) { if (doc.id == '412918563004231700') {
emit(doc.id, null); } work? Note that in order to see the document
with this map, you have to use ?include_docs=true.
Maps are real functions, and what you have there is an assignment.
Regards,
Jonas
On 4 March 2015, Ayhan Kesenci <[email protected]> wrote:
Hey friends how should my map function looks like to find this
document
412918563004231700
doc.id="412918563004231700") doenst work :(
Thank you
Ayhan