summaryrefslogtreecommitdiff
path: root/src/mongo/idl/basic_types.idl
blob: 7005fdc4bc3b9c847b11694966108a357ca2ac40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Copyright (C) 2018-present MongoDB, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the Server Side Public License, version 1,
# as published by MongoDB, Inc.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# Server Side Public License for more details.
#
# You should have received a copy of the Server Side Public License
# along with this program. If not, see
# <http://www.mongodb.com/licensing/server-side-public-license>.
#
# As a special exception, the copyright holders give permission to link the
# code of portions of this program with the OpenSSL library under certain
# conditions as described in each individual source file and distribute
# linked combinations including the program with the OpenSSL library. You
# must comply with the Server Side Public License in all respects for
# all of the code used other than as permitted herein. If you modify file(s)
# with this exception, you may extend this exception to your version of the
# file(s), but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version. If you delete this
# exception statement from all source files in the program, then also delete
# it in the license file.
#

# IDL Basic Types
global:
    cpp_namespace: "mongo"
    cpp_includes:
        - "mongo/db/namespace_string.h"
        - "mongo/util/uuid.h"

types:
    string:
        bson_serialization_type: string
        description: "A BSON UTF-8 string"
        cpp_type: "std::string"
        deserializer: "mongo::BSONElement::str"

    int:
        bson_serialization_type: int
        description: "A BSON 32-bit integer"
        cpp_type: "std::int32_t"
        deserializer: "mongo::BSONElement::_numberInt"

    safeInt64:
        bson_serialization_type:
                                - long
                                - int
                                - decimal
                                - double
        description: "Accepts any numerical type within int64 range"
        cpp_type: std::int64_t
        deserializer: "mongo::BSONElement::safeNumberLong"

    long:
        bson_serialization_type: long
        description: "A BSON 64-bit integer"
        cpp_type: "std::int64_t"
        deserializer: "mongo::BSONElement::_numberLong"

    double:
        bson_serialization_type: double
        description: "A BSON 64-bit floating point number"
        cpp_type: "double"
        deserializer: "mongo::BSONElement::_numberDouble"

    decimal:
        bson_serialization_type: double
        description: "A BSON 128-bit floating point decimal number"
        cpp_type: "mongo::Decimal128"
        deserializer: "mongo::BSONElement::_numberDecimal"

    bool:
        bson_serialization_type: bool
        description: "A BSON bool"
        cpp_type: "bool"
        deserializer: "mongo::BSONElement::boolean"

    safeBool:
        bson_serialization_type:
                                - bool
                                - long
                                - int
                                - decimal
                                - double
        description: "Accepts any numerical type (including bool) which can be interpreted as a
                      true/false value"
        cpp_type: bool
        deserializer: "mongo::BSONElement::trueValue"

    bindata_generic:
        bson_serialization_type: bindata
        bindata_subtype: generic
        description: "A BSON bindata of "
        cpp_type: "std::vector<std::uint8_t>"
        deserializer: "mongo::BSONElement::_binDataVector"

    bindata_function:
        bson_serialization_type: bindata
        bindata_subtype: function
        description: "A BSON bindata of function sub type"
        cpp_type: "std::vector<std::uint8_t>"
        deserializer: "mongo::BSONElement::_binDataVector"

    bindata_uuid:
        bson_serialization_type: bindata
        bindata_subtype: uuid
        description: "A BSON bindata of uuid sub type"
        cpp_type: "std::array<std::uint8_t, 16>"
        deserializer: "mongo::BSONElement::uuid"

    uuid:
        bson_serialization_type: bindata
        bindata_subtype: uuid
        description: "A UUID"
        cpp_type: "mongo::UUID"
        deserializer: "UUID"
        serializer: "mongo::UUID::toCDR"

    bindata_md5:
        bson_serialization_type: bindata
        bindata_subtype: md5
        description: "A BSON bindata of uuid sub type"
        cpp_type: "std::array<std::uint8_t, 16>"
        deserializer: "mongo::BSONElement::md5"

    objectid:
        bson_serialization_type: objectid
        description: "A BSON ObjectID"
        cpp_type: "mongo::OID"
        deserializer: "mongo::BSONElement::OID"

    object:
        bson_serialization_type: object
        description: "A BSONObj without custom deserialization or serialization"
        cpp_type: "mongo::BSONObj"

    date:
        bson_serialization_type: date
        description: "A BSON UTC DateTime"
        cpp_type: "mongo::Date_t"
        deserializer: "mongo::BSONElement::date"

    timestamp:
        bson_serialization_type: timestamp
        description: "A BSON TimeStamp"
        cpp_type: "mongo::Timestamp"
        deserializer: "mongo::BSONElement::timestamp"

    namespacestring:
        bson_serialization_type: string
        description: "A MongoDB NamespaceString"
        cpp_type: "mongo::NamespaceString"
        serializer: mongo::NamespaceString::toString
        deserializer: mongo::NamespaceString