How do I describe a collection in Mongo?

前端 未结 12 608
终归单人心
终归单人心 2021-01-31 02:32

So this is Day 3 of learning Mongo Db. I\'m coming from the MySql universe...

A lot of times when I need to write a query for a MySql table I\'m unfamiliar with, I woul

12条回答
  •  粉色の甜心
    2021-01-31 02:51

    Type the below query in editor / mongoshell

    var col_list= db.emp.findOne();
    for (var col in col_list) { print (col) ; }
    

    output will give you name of columns in collection :

    _id
    name
    salary
    

提交回复
热议问题