Hello All,
In this blog we will discuss about how to get all keys in mongoDb collection.
Sometimes we are in a situation in which we want only the keys not the data itself from the collection.
So as a result you can try by following below code to fetch the keys:
Syntax-
var dataKeys = db.collection.findOne();
for (var key in dataKeys) { print (key) ; }
Example-
> var data = db.keytags.findOne();
> for (var key in data) { print (key) ; }
Output-
> for (var key in data) { print (key) ; }
__;v
_id
additionalProperties
businessId
clientId
createdAt
creatorAccountId
dataChecksum
deleted
domain
donotIndex
isDomainCard
kiTAG
lastIndexedOn
manualUpdate
name
relatedKeywords
seo
status
title
type
updatedAt
>
0 Comment(s)