mirror of
https://github.com/mainflux/mainflux.git
synced 2025-05-02 22:17:10 +08:00

* Add mongodb-writer Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add official mongodb driver Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Move Connect to main.go Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Remove bson.NewDoc and write msg directly in db Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add MongoDB writer tests Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Update README.md Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Add mongodb services compose to addons dir Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Update docs Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Update docs and tests Refactor code. Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Expose MetricsMiddleware to align writers with other services Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Add logging middleware Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com> * Update load tests version Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
19 lines
862 B
Go
19 lines
862 B
Go
// Copyright (C) MongoDB, Inc. 2017-present.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
// not use this file except in compliance with the License. You may obtain
|
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
package bson
|
|
|
|
// node is a compact representation of an element within a BSON document.
|
|
// The first 4 bytes are where the element starts in an underlying []byte. The
|
|
// last 4 bytes are where the value for that element begins.
|
|
//
|
|
// The type of the element can be accessed as `data[n[0]]`. The key of the
|
|
// element can be accessed as `data[n[0]+1:n[1]-1]`. This will account for the
|
|
// null byte at the end of the c-style string. The value can be accessed as
|
|
// `data[n[1]:]`. Since there is no value end byte, an unvalidated document
|
|
// could result in parsing errors.
|
|
type node [2]uint32
|