One more little thing: per spec, for...in enumerates the array keys as
strings.
A
On Thu, Sep 3, 2009 at 8:29 AM, Jesse Hallett wrote:
> According to Crockford `for in` gives no guarantee that it will iterate
> over
> array elements in order. That is in addition to the problem that it will
> al
According to Crockford `for in` gives no guarantee that it will iterate over
array elements in order. That is in addition to the problem that it will
also enumerate any attributes on `Array.prototype`. So Crockford recommends
using `for` with an incrementing index variable instead.
In my opinion
On 3 Sep 2009, at 11:11, Simon Metson wrote:
Hi,
I'm not sure if there's a technical benefit of this syntax, but I
think I prefer reading it... Any JS wizards out there like to comment?
to get for(... in .. ) right you need to add:
a hasOwnProperty() call to account for prototypical inher
Hi,
I'm not sure if there's a technical benefit of this syntax, but I
think I prefer reading it... Any JS wizards out there like to comment?
Cheers
Simon
On 3 Sep 2009, at 09:53, Nils Breunese wrote:
I even learned that using for (... in ...) is not safe for use with
arrays. I tend to use
user@couchdb.apache.org
Onderwerp: Re: View to find someone in a list in a document
Style police!
On 2 Sep 2009, at 19:00, Simon Metson wrote:
> Hi,
> Do you mean you want to emit each user as a key? Something like:
>
> function(doc) { for (v in doc.users) { emit(doc.users[v], doc); }
is
Thanks guys for your help ! :)
2009/9/2 Simon Metson
> Hey Jan,
>
> function(doc) { for (var v in doc.users) { emit(doc.users[v], doc); }
>>
>> if you leave out the `var` you create a global variable (as opposed to a
>> local variable in JS and that can have funky effects.
>>
>
> What he said.
Hey Jan,
function(doc) { for (var v in doc.users) { emit(doc.users[v], doc); }
if you leave out the `var` you create a global variable (as opposed
to a local variable in JS and that can have funky effects.
What he said.
function(doc) { if(doc.users) { for (var v in doc.users)
{ emit(doc.
Style police!
On 2 Sep 2009, at 19:00, Simon Metson wrote:
Hi,
Do you mean you want to emit each user as a key? Something like:
function(doc) { for (v in doc.users) { emit(doc.users[v], doc); }
is better written as
function(doc) { for (var v in doc.users) { emit(doc.users[v], doc);
Thanks a lot ! I'll try it.
2009/9/2 Simon Metson
> Ok, so use that map function and query it as:
>
> http://localhost:5984/test/_design/users/_view/user?key=
>
> That will give you back all the documents that have in the
> users list.
> Cheers
> Simon
>
>
>
> On 2 Sep 2009, at 18:12, Jehan Bi
Ok, so use that map function and query it as:
http://localhost:5984/test/_design/users/_view/user?key=
That will give you back all the documents that have in the
users list.
Cheers
Simon
On 2 Sep 2009, at 18:12, Jehan Bihin wrote:
Hi Simon,
Thanks for your help.
I need the document if
Hi Simon,
Thanks for your help.
I need the document if the key is present in the list.
Thanks,
Jehan
2009/9/2 Simon Metson
> Hi,
>Do you mean you want to emit each user as a key? Something like:
>
> function(doc) { for (v in doc.users) { emit(doc.users[v], doc); }
>
> as a map would
Hi,
Do you mean you want to emit each user as a key? Something like:
function(doc) { for (v in doc.users) { emit(doc.users[v], doc); }
as a map would do that.
Cheers
Simon
On 2 Sep 2009, at 17:25, Jehan Bihin wrote:
Hi all,
(sorry for my english)
I have a document having a list of pe
Hi all,
(sorry for my english)
I have a document having a list of persons :
...
"users":{"membre-joouul_hotmail.com":["createur"],"membre-killan_daaboo.net
":["moderateur"]}
...
Each persons have some roles.
My key is the membre like 'membre-joouul_hotmail.com'
And i want to list all document ha
13 matches
Mail list logo