You want use $elemMatch to test for items in an array: http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-ValueinanArray
In karras that would be: (fetch-one projects (where (element-match :users uu))) That doesn't explain why the first query passed. I can recreate it, but I don't understand it. I'll look into it more closely later. BTW, I don't check the clojure group too often. I do receive emails from the karras-dev group: http://groups.google.com/group/karras-dev - Wilkes On Oct 27, 10:13 am, Victor Marzo <samsa...@gmail.com> wrote: > I'm trying to update a document that has an user list inside: > > test.db> (def uu (fetch-one users (where (eq :name "victor")))) > #'test.db/uu > test.db> uu > {:password "1234", :name "victor", :_id #<ObjectId > 4cbda9037fc2dffea9affbd7>} > test.db> (def pp (insert projects {:name "test" :users [uu]})) > #'test.db/pp > test.db> pp > {:_id #<ObjectId 4cc83eed9c5bdfb15517ed18>, :users ({:_id #<ObjectId > 4cbda9037fc2dffea9affbd7>, :name "victor", :password "1234"}), :name > "test"} > test.db> (fetch-one projects (where (in :users [uu]))) > {:users ({:_id #<ObjectId 4cbda9037fc2dffea9affbd7>, :name > "victor", :password "1234"}), :name "asdfsdaf", :_id #<ObjectId > 4cc83c019c5bdfb15417ed18>} -------- until this all works ok > test.db> (update projects (where (eq :name "test")) (merge pp {:name > "test2"})) > #<WriteResult { "err" : null , "updatedExisting" : true , "n" : 1 , > "ok" : 1.0}> > test.db> (fetch-one projects (where (in :users [uu]))) > nil ---------------- ????? > test.db> (fetch-all projects) > ({:name "test2", :users ({:password "1234", :name "victor", :_id > #<ObjectId 4cbda9037fc2dffea9affbd7>}), :_id #<ObjectId > 4cc840c19c5bdfb15917ed18>}) ---- it seems to be ok. I don't know why > the previous query fails. > > I don't know what I'm doing wrong. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en