Is there any opprtunity to list all data types of a document in couchdb like string, object,integer ?
I'm using only curl with a Windows machine.
If you desire to use purely CURL on the client side you will need to create a design document to answer your query. The design document would have the following mapping function:
function(doc) {
function obj_to_types( obj ){
var types = {};
Object.keys( obj ).forEach( function( k ) {
var prop = obj[k];
var type = typeof prop;
var typeValue;
if( type == "object" ){
typeValue = obj_to_types( prop );
}else{
typeValue = type;
}
types[k] =typeValue;
});
return types;
}
emit(doc.id, obj_to_types( doc ));
}
This will produce output for each document such as:
{
_id: "string",
_rev: "string",
format: {
0: "number",
1: "number",
2: "number"},
etc: "string"
}
CouchDB is using JSON, and JSON does have a limited set of datatypes, described here: http://json.org/
Any higher level datatype like "DateTime" or such, are a matter of format and not standardized.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.