user1632928
user1632928

Reputation: 252

tornadoweb motor move document between collections

Is there a smart way for moving document from one collection to another? I want to read document from collection 1, do insert in collection 2 and remove document from 1.

It's doable with 3 steps, but maybe there is a smarter way?

Greets!

Upvotes: 1

Views: 41

Answers (1)

GeertPt
GeertPt

Reputation: 17854

In MongoDB 2.5.4 (beta), there's a new $out operator for the aggregation pipeline: http://docs.mongodb.org/master/reference/operator/aggregation/out/. This will overwrite the whole target collection, so I guess this is not what you want.

There's no other atomic operation across collections, AFAIK, so you'll need the 3 steps.

Upvotes: 1

Related Questions