mongodb - Inserting in inside a function -


i newbie @ interacting mongo , trying make function using in property:

def find_inthe(key,*values):     rdo=col.find({key:{'$in':list(values)}})     in rdo:         return  print(find_inthe('hair_colour','white','brown','black')) 

however problem finding is returning first of values , find_one.

if try same outside function:

rdo=col.find({'hair_colour':{'$in':['white','brown','black']}})           in rdo:     print(a) 

it return dictionaries of collection.

my desired output function returns dictionaries selected colour hairs

$in not @ fault here. it's return a in loop. why don't return whole thing?

def find_inthe(key,*values):     rdo = col.find({key:{'$in':list(values)}})     return list(rdo) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -