[00:06:44] <GothAlice> piklu: http://docs.mongodb.org/manual/reference/method/db.collection.update/ — pass a query in and check nModified to see how many records were modified. However, define "changed".
[00:07:20] <piklu> GothAlice: Actually it is something like update or insert
[00:09:35] <GothAlice> http://docs.mongodb.org/manual/reference/method/db.collection.update/#insert-a-new-document-if-no-match-exists and http://docs.mongodb.org/manual/reference/method/db.collection.update/#upsert-option are the important sections, here.
[00:09:39] <GothAlice> Upsert will do for "update, or insert".
[00:19:39] <GothAlice> So, your actual question was: "I'm currently dropping and restoring a collection to synchronize it. Is there a way I can update existing records, and insert new ones, without having to clear the collection first?" The answer is: yes, upserts. :)
[00:20:10] <piklu> I am actualy now having trouble sorting it
[00:20:44] <piklu> can i sort it on the order of the inserts?
[00:21:49] <GothAlice> "Natural" order is typically insertion order, but with upserts not every change will insert a record, thus no. (Sorting on _id, if it's an ObjectId, will give you literal insertion order, but again, upserts won't generate new IDs.)
[00:22:00] <GothAlice> (Rather, won't generate new IDs for updated records, only inserted ones.)
[01:37:34] <joannac> piklu: if you are using the same syntax as GothAlice I can't see why $set would be treated as a method. So please share the exact code you're running
[01:45:54] <GothAlice> piklu: No, your problem is mystifying and unique. Your best bet, if you can, is to look at the source file and line indicated by the explosion to see what it expects.
[01:46:18] <piklu> is there any alternative way to do it?
[01:47:24] <GothAlice> … other than investigating the code on your disk that is causing you trouble, but not us? Not really.