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 ...
随机推荐
- 标准C程序设计七---74
Linux应用 编程深入 语言编程 标准C程序设计七---经典C11程序设计 以下内容为阅读: <标准C程序设计>(第7版) 作者 ...
- [Python Cookbook] Numpy: How to Apply a Function to 1D Slices along the Given Axis
Here is a function in Numpy module which could apply a function to 1D slices along the Given Axis. I ...
- CEF General Usage(CEF3预览)
CEF General Usage(CEF3预览) 介绍 CEF全称Chromium Embedded Framework,是一个基于Google Chromium 的开源项目.Google Chro ...
- window 驱动开发
http://blog.csdn.net/chenyujing1234/article/category/1147469/5
- python获取对象的信息
Types 判断基本数据类型可以直接写int,str等,但如果要判断一个对象是否是函数怎么办?可以使用types模块中定义的常量. >>> import types >> ...
- Data.FireDACJSONReflect单元不支持跨平台
Data.FireDACJSONReflect不支持跨平台 Data.FireDACJSONReflect里面:IFDJSONDeltasApplyUpdates,TFDJSONDeltas,TFDJ ...
- java高级编程-使用反射强制给private字段赋值
转自:http://blog.csdn.net/yaerfeng/article/details/7103397 今天项目中遇到了一个问题,要调用一个类,并获取这个类的属性进行赋值然后将这个类传递到方 ...
- SSH 原理和公匙私匙
先主要介绍了Telnet.SSH 的通信原理,分析了其通信时的工作流程. Telnet 无论Telnet协议连接的是什么类型终端,都会转换为NVT(Net Virtual Terminal)格式进行通 ...
- php自己编译安装后,再给这个编译安装的php版本添加拓展模块的处理办法。
原文: https://www.cnblogs.com/zongyl/p/5924627.html 说明,给编译安装之后的php 添加pgsql 拓展成功. --------------------- ...
- 基于ACCESS和ASP的SQL多个表查询与计算统计代码(一)
近期在写几个关于"Project - Subitem - Task"的管理系统,说是系统还是有点夸大了,基本就是一个多表查询调用和insert.update的数据库操作.仅仅是出现 ...