src/github.com/mongodb/mongo-go-driver/mongo/cursor.go 游标的简洁实用
src/github.com/mongodb/mongo-go-driver/mongo/cursor.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 mongo import (
"context" "github.com/mongodb/mongo-go-driver/bson"
) // Cursor instances iterate a stream of documents. Each document is
// decoded into the result according to the rules of the bson package.
//
// A typical usage of the Cursor interface would be:
//
// var cur Cursor
// ctx := context.Background()
// defer cur.Close(ctx)
//
// for cur.Next(ctx) {
// elem := bson.NewDocument()
// if err := cur.Decode(elem); err != nil {
// log.Fatal(err)
// }
//
// // do something with elem....
// }
//
// if err := cur.Err(); err != nil {
// log.Fatal(err)
// }
//
type Cursor interface {
// NOTE: Whenever ops.Cursor changes, this must be changed to match it. // Get the ID of the cursor.
ID() int64 // Get the next result from the cursor.
// Returns true if there were no errors and there is a next result.
Next(context.Context) bool Decode(interface{}) error DecodeBytes() (bson.Reader, error) // Returns the error status of the cursor
Err() error // Close the cursor.
Close(context.Context) error
}
src/github.com/mongodb/mongo-go-driver/mongo/cursor.go 游标的简洁实用的更多相关文章
- MongoDB - Introduction of the mongo Shell
Introduction The mongo shell is an interactive JavaScript interface to MongoDB. You can use the mong ...
- MongoDB源码分析——mongo与JavaScript交互
mongo与JavaScript交互 源码版本为MongoDB 2.6分支 之前已经说过mongo是MongoDB提供的一个执行JavaScript脚本的客户端工具,执行js其实就是一个js和 ...
- MongoDB源码分析——mongo主程序入口分析
Edit 源码版本为MongoDB 2.6分支 mongo主程序入口分析 mongo是MongoDB提供的一个执行JavaScript脚本的客户端工具,可以用来和服务端交互,2.6版本的Mongo ...
- 插入MongoDB文档:mongo控制台查看插入到MongoDB文档中的内容
const MongoClient = require('mongodb').MongoClient; const assert = require('assert'); const url = 'm ...
- mongodb学习之:mongo安装以及远程访问
在linux下通过apt-get install mongo的方式一键式安装mongo 安装后mongo的配置文件位于/etc/mongodb.conf. 里面有mongo的各项配置,文件内容如下:重 ...
- Mongodb Compile C++ Driver
之前发现直接编译mongo源码中的驱动,静态库的驱动会很大,在链接使用的时候会报很多链接错误. 转而直接编译单独提供驱动源码,同样vc2008的版本也要做我的另一篇博文中修改,在这不多说,具体参见: ...
- MongoDB数据库CXX Driver编译
最近项目需要,想要测试下MongoDB读写大量小图片的速度(单纯文件系统io效率比较低,想试试NoSQL能不能提速), 因为使用C++开发,所以使用MongoDB的CXX驱动,需要自己编译,下面记录整 ...
- mongodb MongoDB C#/.NET driver version
The first column lists the driver version(s). C#/.NET Driver Version MongoDB 2.6 MongoDB 3.0 MongoDB ...
- ubuntu mongodb报错:mongo - couldn't connect to server 127.0.0.1:27017
在进入mongo的时候,出现在下面错误信息.那如何解决呢? 标记一下,以便下次理碰的到时候,有个参考. warning: Failed to connect to 127.0.0.1:27017, r ...
随机推荐
- transform与position:fixed的那些恩怨--摘抄
1. 前言 在写这篇文章之前,我理解的fixed元素是这样的:(摘自CSS布局基础) 固定定位与absolute定位类型类似,但它的相对移动的坐标是视图(屏幕内的网页窗口)本身.由于视图本身是固定的, ...
- C++ 细节知识
1.typedef struct child {string name;struct child* next;}; child* head; head = (child*)malloc(sizeof( ...
- 使用iframe实现提交表单不刷新页面
正常情况下,当你向服务器发送数据的时候,你的浏览器将会打开action页面,并且不会重回到当前页面.但是有的时候,我们因为各种各样的要求,而不希望浏览器在提交数据的时候去刷新当前的页面或者转向到新的页 ...
- Android调起地图导航
想要使用导航功能可以使用各个地图的开放平台集成导航模块,如果不想集成也可以调起相关app导航 调起其他app首先得使用到该app包名,先贴出来 public final static Strin ...
- babel6的babel-plugin-add-module-exports插件
干什么的 在 babel 5 时代, export default {}; 除了会被转译成 exports.default = {};,还会加一句 module.exports = exports.d ...
- BZOJ——2101: [Usaco2010 Dec]Treasure Chest 藏宝箱
http://www.lydsy.com/JudgeOnline/problem.php?id=2101 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: ...
- git常用语句
1.安装git,也适用于升级 yum -y install gcc zlib-devel openssl-devel curl-devel \ expat-devel gettext-devel pe ...
- PropertyPlaceholderConfigurer 基本用法
目录 一.PropertyPlaceholderConfigurer 的继承体系 二.PropertyPlaceholderConfigurer 的基本概念 三.PropertyPlaceholder ...
- Android 调用.so包时报错:No implementation found for native Lxxx, java.lang.UnsatisfiedLinkError: XXX时的解决办法(转)
问题就是在调用自己同事写的.so包时,怎么也掉不通,程序一直报错退出,错误内容就是: 1 No implementation found for native Lxxx, 2 Java.lang.Un ...
- Android 自定义录音、播放动画View,让你的录音浪起来
最近公司项目有一个录音的录制和播放动画需求,然后时间是那么紧,那么赶紧开撸. 先看效果图 嗯,然后大致就是这样,按住录音,然后有一个倒计时,最外层一个进度条,还有一个类似模拟声波的动画效果(其实中间的 ...