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

Reply via email to