soredive
soredive

Reputation: 813

mongodb, copy all documents to collection

collection_A is mapReduced result.

If I want to save { '11-8-12' : collection_A} in collection_B.

How can I save one collection to another collection, as one of elements?

Upvotes: 0

Views: 836

Answers (1)

Karoly Horvath
Karoly Horvath

Reputation: 96258

I don't think you can directly do that.

You have to manually build the document and save it to the database.

You can write this in JS and execute it with db.eval(...) so that data won't be transferred to the client, but this will convert integers to floats (the same problem you have with the mongodb shell).

Upvotes: 1

Related Questions