How to get mongodb schema dump

I can take a backup of mongodb data, but I'm not sure about the mongodb schama backup. Is there a way to dump a MONGODB schema just not data?

+4
source share
2 answers

You need to use mongorestore ... which is used for things like import json or csv etc.

You can learn more about mongorestore in the docs below; I would look and read them, as they are very useful.

http://www.mongodb.org/display/DOCS/Import+Export+Tools#ImportExportTools-mongorestore

You can also check out http://learnmongo.com tips and help! or you can visit the links

mongodump? , .

+2

MongoDB - NoSQL.

, mongo , .

. NoSQL DB, mongodb, , , .

. .

db.mycollection.insert([ 
{ "_id":1, "name":"A"}, 
{ "_id":2, "name":"CD", "age":29}, 
{ "_id":3, "name":"AB", "age":28}, 
{ "_id":4, "name":"ABC", "age":27, "emailId":"abc@xyz.com"}, 
{ "_id":5, "name":"ABCD", "age":29, "emailId":"abcd@xyz.com"}]);

db.mycollection.find();

{ "_id" : 1, "name" : "A" }
{ "_id" : 2, "name" : "CD", "age" : 29 }
{ "_id" : 3, "name" : "AB", "age" : 28 }
{ "_id" : 4, "name" : "ABC", "age" : 27, "emailId" : "abc@xyz.com" }
{ "_id" : 5, "name" : "ABCD", "age" : 29, "emailId" : "abcd@xyz.com" }

In Mongo Shell
var k = db.mycollection.findOne();
for ( i in k){print (i)};
  _id
  name

, .

0

Source: https://habr.com/ru/post/1669018/


All Articles