diff options
27 files changed, 0 insertions, 2478 deletions
diff --git a/SConscript.buildinfo b/SConscript.buildinfo index 62f7f9233b5..5585bb64c4d 100644 --- a/SConscript.buildinfo +++ b/SConscript.buildinfo @@ -64,4 +64,3 @@ env.Command(buildinfo_filename, Action(generate_buildinfo, "Generating $TARGET")) env.AlwaysBuild(buildinfo_filename) env.Install('$BUILD_DIR/mongo', buildinfo_filename) -env.Install('$BUILD_DIR/client_build/mongo', buildinfo_filename) diff --git a/SConstruct b/SConstruct index ef392413cb5..8a61055ab21 100644 --- a/SConstruct +++ b/SConstruct @@ -196,16 +196,12 @@ add_option( "extra-variant-dirs", "extra variant dir components, separated by co add_option( "add-branch-to-variant-dir", "add current git branch to the variant dir", 0, False ) add_option( "variant-dir", "override variant subdirectory", 1, False ) -add_option( "sharedclient", "build a libmongoclient.so/.dll [DEPRECATED/IGNORED]" , 0 , False ) -add_option( "full", "include client and headers when doing scons install [DEPRECATED/IGNORED]", 0 , False ) - # linking options add_option( "release" , "release build" , 0 , True ) add_option( "static" , "fully static build" , 0 , False ) add_option( "static-libstdc++" , "statically link libstdc++" , 0 , False ) add_option( "lto", "enable link time optimizations (experimental, except with MSVC)" , 0 , True ) add_option( "dynamic-windows", "dynamically link on Windows", 0, True) -add_option( "disable-declspec-thread", "don't use __declspec(thread) on Windows [DEPRECATED/IGNORED]", 0, True) # base compile flags add_option( "64" , "whether to force 64 bit" , 0 , True , "force64" ) @@ -1742,7 +1738,6 @@ Export("s3push") Export("use_clang") env.SConscript('src/SConscript', variant_dir='$BUILD_DIR', duplicate=False) -env.SConscript('src/SConscript.client', variant_dir='$BUILD_DIR/client_build', duplicate=False) env.SConscript(['SConscript.buildinfo', 'SConscript.smoke']) def clean_old_dist_builds(env, target, source): diff --git a/src/SConscript.client b/src/SConscript.client deleted file mode 100644 index c17009ae0b0..00000000000 --- a/src/SConscript.client +++ /dev/null @@ -1,52 +0,0 @@ -# -*- mode: python -*- - -# This SConscript used to describe the build and install rules for the Mongo C++ driver. Now it -# causes the relevant targets to emit an error message informing users that the client driver -# is now maintained in a separate repo, and provides a link to the documentation on how to -# build the driver. - -import os -import textwrap - -Import('env') - -def failClient(target, source, env): - failClientMessage = ''' - PLEASE NOTE: The C++ client driver repository has been moved to - http://github.com/mongodb/mongo-cxx-driver - - As of MongoDB 2.6.0, the C++ client library has been separated from the core database - server repository into a separate git repository. The targets specific to the C++ driver - can no longer be built from the server codebase. - - In particular, the following targets are no longer availble in this repository: - mongoclient - install-mongoclient - check-install-mongoclient - clientTests - smokeClient - - Additionally, the following SCons options no longer have any effect in this repository, - though they are accepted without error for backward compatibility: - --sharedclient - --full - --disable-declspec-thread - - For detailed instructions on how to build the C++ driver, please - see http://dochub.mongodb.org/core/build-cpp-driver - ''' - print(textwrap.dedent(failClientMessage)) - Exit(1) - -failClientAction = env.Action(failClient, cmdstr=None) -failClientTargets = [ - 'check-install-mongoclient', - 'clientTests', - 'install-mongoclient', - 'mongoclient', - 'smokeClient', -] - -env.AlwaysBuild( - [env.Alias(target, [], failClientAction) for target in failClientTargets] -) diff --git a/src/mongo/bson/bson.h b/src/mongo/bson/bson.h deleted file mode 100644 index 3ccbaec5a21..00000000000 --- a/src/mongo/bson/bson.h +++ /dev/null @@ -1,56 +0,0 @@ -/** @file bson.h - - Main bson include file for mongodb c++ clients. MongoDB includes ../db/jsobj.h instead. - This file, however, pulls in much less code / dependencies. - - @see bsondemo -*/ - -/* - * Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - Main include file for C++ BSON. This pulls in fewer dependencies than - mongo/client/dbclient.h, but still requires libmongoclient to link. - - "BSON" stands for "binary JSON" -- ie a binary way to represent objects that would be - represented in JSON (plus a few extensions useful for databases & other languages). - - http://www.bsonspec.org/ -*/ - -#pragma once - -#ifdef MONGO_EXPOSE_MACROS -#error bson.h is for C++ driver consumer use only -#endif - -#define LIBMONGOCLIENT_CONSUMER - -#include "mongo/client/redef_macros.h" - -#include "mongo/pch.h" - -#include "mongo/bson/bsonelement.h" -#include "mongo/bson/bsonobj.h" -#include "mongo/bson/bsonobjbuilder.h" -#include "mongo/bson/bsonobjiterator.h" -#include "mongo/bson/bsontypes.h" -#include "mongo/bson/bson-inl.h" -#include "mongo/bson/oid.h" -#include "mongo/bson/util/builder.h" - -#include "mongo/client/undef_macros.h" diff --git a/src/mongo/bson/bsondemo/bsondemo.cpp b/src/mongo/bson/bsondemo/bsondemo.cpp deleted file mode 100644 index d0f69bbcee5..00000000000 --- a/src/mongo/bson/bsondemo/bsondemo.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// @file bsondemo.cpp - -/* - * Copyright 2010 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - Example of use of BSON from C++. Example is solely BSON, no MongoDB involved. - - Requires boost (headers only). - Works as c++ "headers-only" (the parts actually exercised herein that is - some functions require .cpp files). - - To build and run: - # "../../.." is the directory mongo/src/ - g++ -o bsondemo -I ../../.. bsondemo.cpp - ./bsondemo - - Windows: project files are available in this directory for bsondemo.cpp for use with Visual Studio. -*/ - -#include "mongo/client/dbclient.h" - -#include <iostream> -#include <vector> - -using namespace std; -using namespace bson; - -void iter(bo o) { - /* iterator example */ - cout << "\niter()\n"; - for( bo::iterator i(o); i.more(); ) { - cout << ' ' << i.next().toString() << '\n'; - } -} - -int main() { - cout << "build bits: " << 8 * sizeof(char *) << '\n' << endl; - - /* a bson object defaults on construction to { } */ - bo empty; - cout << "empty: " << empty << endl; - - /* make a simple { name : 'joe', age : 33.7 } object */ - { - bob b; - b.append("name", "joe"); - b.append("age", 33.7); - b.obj(); - } - - /* make { name : 'joe', age : 33.7 } with a more compact notation. */ - bo x = bob().append("name", "joe").append("age", 33.7).obj(); - - /* convert from bson to json */ - string json = x.toString(); - cout << "json for x:" << json << endl; - - /* access some fields of bson object x */ - cout << "Some x things: " << x["name"] << ' ' << x["age"].Number() << ' ' << x.isEmpty() << endl; - - /* make a bit more complex object with some nesting - { x : 'asdf', y : true, subobj : { z : 3, q : 4 } } - */ - bo y = BSON( "x" << "asdf" << "y" << true << "subobj" << BSON( "z" << 3 << "q" << 4 ) ); - - /* print it */ - cout << "y: " << y << endl; - - /* reach in and get subobj.z */ - cout << "subobj.z: " << y.getFieldDotted("subobj.z").Number() << endl; - - /* alternate syntax: */ - cout << "subobj.z: " << y["subobj"]["z"].Number() << endl; - - /* fetch all *top level* elements from object y into a vector */ - vector<be> v; - y.elems(v); - cout << v[0] << endl; - - /* into an array */ - list<be> L; - y.elems(L); - - bo sub = y["subobj"].Obj(); - - /* grab all the int's that were in subobj. if it had elements that were not ints, we throw an exception - (capital V on Vals() means exception if wrong type found - */ - vector<int> myints; - sub.Vals(myints); - cout << "my ints: " << myints[0] << ' ' << myints[1] << endl; - - /* grab all the string values from x. if the field isn't of string type, just skip it -- - lowercase v on vals() indicates skip don't throw. - */ - vector<string> strs; - x.vals(strs); - cout << strs.size() << " strings, first one: " << strs[0] << endl; - - iter(y); - return 0; -} - diff --git a/src/mongo/bson/bsondemo/bsondemo.vcproj b/src/mongo/bson/bsondemo/bsondemo.vcproj deleted file mode 100644 index 8432cebfd87..00000000000 --- a/src/mongo/bson/bsondemo/bsondemo.vcproj +++ /dev/null @@ -1,243 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="bsondemo"
- ProjectGUID="{C9DB5EB7-81AA-4185-BAA1-DA035654402F}"
- RootNamespace="bsondemo"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="c:\program files\boost\latest;c:\boost;\boost"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="1"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="c:\program files\boost\latest;c:\boost;\boost"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\bsondemo.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="bson"
- >
- <File
- RelativePath="..\bson.h"
- >
- </File>
- <File
- RelativePath="..\bson_db.h"
- >
- </File>
- <File
- RelativePath="..\bsonelement.h"
- >
- </File>
- <File
- RelativePath="..\bsoninlines.h"
- >
- </File>
- <File
- RelativePath="..\bsonmisc.h"
- >
- </File>
- <File
- RelativePath="..\bsonobj.h"
- >
- </File>
- <File
- RelativePath="..\bsonobjbuilder.h"
- >
- </File>
- <File
- RelativePath="..\bsonobjiterator.h"
- >
- </File>
- <File
- RelativePath="..\bsontypes.h"
- >
- </File>
- <File
- RelativePath="..\oid.h"
- >
- </File>
- <File
- RelativePath="..\ordering.h"
- >
- </File>
- <Filter
- Name="util"
- >
- <File
- RelativePath="..\util\builder.h"
- >
- </File>
- <File
- RelativePath="..\util\misc.h"
- >
- </File>
- </Filter>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/mongo/bson/bsondemo/bsondemo.vcxproj b/src/mongo/bson/bsondemo/bsondemo.vcxproj deleted file mode 100644 index c2b2a80acfe..00000000000 --- a/src/mongo/bson/bsondemo/bsondemo.vcxproj +++ /dev/null @@ -1,339 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win2008PlusDebug|Win32">
- <Configuration>Win2008PlusDebug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win2008PlusDebug|x64">
- <Configuration>Win2008PlusDebug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win2008PlusRelease|Win32">
- <Configuration>Win2008PlusRelease</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win2008PlusRelease|x64">
- <Configuration>Win2008PlusRelease</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{C9DB5EB7-81AA-4185-BAA1-DA035654402F}</ProjectGuid>
- <RootNamespace>bsondemo</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">$(Configuration)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'">true</LinkIncremental>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)\</OutDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">$(Configuration)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'">$(Configuration)\</IntDir>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
- <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'">false</LinkIncremental>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'" />
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'" />
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>No</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>No</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <MinimalRebuild>No</MinimalRebuild>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|x64'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <MinimalRebuild>No</MinimalRebuild>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <MinimalRebuild>No</MinimalRebuild>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <MinimalRebuild>No</MinimalRebuild>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <MinimalRebuild>No</MinimalRebuild>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|x64'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <MinimalRebuild>No</MinimalRebuild>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="bsondemo.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\bson.h" />
- <ClInclude Include="..\bson_db.h" />
- <ClInclude Include="..\bsonelement.h" />
- <ClInclude Include="..\bsoninlines.h" />
- <ClInclude Include="..\bsonmisc.h" />
- <ClInclude Include="..\bsonobj.h" />
- <ClInclude Include="..\bsonobjbuilder.h" />
- <ClInclude Include="..\bsonobjiterator.h" />
- <ClInclude Include="..\bsontypes.h" />
- <ClInclude Include="..\oid.h" />
- <ClInclude Include="..\ordering.h" />
- <ClInclude Include="..\util\builder.h" />
- <ClInclude Include="..\util\misc.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/src/mongo/bson/bsondemo/bsondemo.vcxproj.filters b/src/mongo/bson/bsondemo/bsondemo.vcxproj.filters deleted file mode 100644 index 2dbd8f1e457..00000000000 --- a/src/mongo/bson/bsondemo/bsondemo.vcxproj.filters +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <ClCompile Include="bsondemo.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\ordering.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bsonelement.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bsoninlines.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bsonmisc.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bsonobj.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bsonobjbuilder.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bsonobjiterator.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bsontypes.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\oid.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bson_db.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\bson.h">
- <Filter>bson</Filter>
- </ClInclude>
- <ClInclude Include="..\util\builder.h">
- <Filter>bson\util</Filter>
- </ClInclude>
- <ClInclude Include="..\util\misc.h">
- <Filter>bson\util</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <Filter Include="bson">
- <UniqueIdentifier>{ea599740-3c6f-40dd-a121-e825d82ae4aa}</UniqueIdentifier>
- </Filter>
- <Filter Include="bson\util">
- <UniqueIdentifier>{5c397ce3-b900-41cd-8af0-a1d456db6854}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
-</Project>
\ No newline at end of file diff --git a/src/mongo/client/dbclient.h b/src/mongo/client/dbclient.h deleted file mode 100644 index 9930688b81e..00000000000 --- a/src/mongo/client/dbclient.h +++ /dev/null @@ -1,44 +0,0 @@ -/** @file dbclient.h - - Include this file when writing client C++ applications, to get access to the - mongod C++ driver. -*/ - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#ifdef MONGO_EXPOSE_MACROS -#error dbclient.h is for C++ driver consumer use only -#endif - -#define LIBMONGOCLIENT_CONSUMER - -#include "mongo/client/redef_macros.h" - -#include "mongo/pch.h" - -#include "mongo/client/connpool.h" -#include "mongo/client/dbclient_rs.h" -#include "mongo/client/dbclientcursor.h" -#include "mongo/client/dbclientinterface.h" -#include "mongo/client/gridfs.h" -#include "mongo/client/init.h" -#include "mongo/client/sasl_client_authenticate.h" -#include "mongo/client/syncclusterconnection.h" -#include "mongo/util/net/ssl_options.h" - -#include "mongo/client/undef_macros.h" diff --git a/src/mongo/client/examples/authTest.cpp b/src/mongo/client/examples/authTest.cpp deleted file mode 100644 index 81ce22e4502..00000000000 --- a/src/mongo/client/examples/authTest.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// authTest.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <boost/scoped_ptr.hpp> -#include <iostream> -#include <cstdlib> -#include <string> -#include "mongo/client/dbclient.h" - -using namespace mongo; - -int main( int argc, const char **argv ) { - - const char *port = "27017"; - if ( argc != 1 ) { - if ( argc != 3 ) { - std::cout << "need to pass port as second param" << endl; - return EXIT_FAILURE; - } - port = argv[ 2 ]; - } - - Status status = client::initialize(); - if (!status.isOK()) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - std::string errmsg; - ConnectionString cs = ConnectionString::parse(string("127.0.0.1:") + port, errmsg); - if (!cs.isValid()) { - cout << "error parsing url: " << errmsg << endl; - return EXIT_FAILURE; - } - - boost::scoped_ptr<DBClientBase> conn(cs.connect(errmsg)); - if (!conn) { - cout << "couldn't connect: " << errmsg << endl; - return EXIT_FAILURE; - } - - BSONObj ret; - // clean up old data from any previous tests - conn->runCommand( "test", BSON("removeUsersFromDatabase" << 1), ret ); - - conn->runCommand( "test", - BSON( "createUser" << "eliot" << - "pwd" << "bar" << - "roles" << BSON_ARRAY("readWrite")), - ret); - - errmsg.clear(); - conn->auth(BSON("user" << "eliot" << - "db" << "test" << - "pwd" << "bar" << - "mechanism" << "MONGODB-CR")); - - try { - conn->auth(BSON("user" << "eliot" << - "db" << "test" << - "pwd" << "bars" << // incorrect password - "mechanism" << "MONGODB-CR")); - // Shouldn't get here. - cout << "Authentication with invalid password should have failed but didn't" << endl; - return EXIT_FAILURE; - } catch (const DBException& e) { - // expected - } - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/examples/clientTest.cpp b/src/mongo/client/examples/clientTest.cpp deleted file mode 100644 index ab136b326a8..00000000000 --- a/src/mongo/client/examples/clientTest.cpp +++ /dev/null @@ -1,306 +0,0 @@ -// clientTest.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * a simple test for the c++ driver - */ - -// this header should be first to ensure that it includes cleanly in any context -#include "mongo/client/dbclient.h" - -#include <iostream> - -#ifndef verify -# define verify(x) MONGO_verify(x) -#endif - -using namespace std; -using namespace mongo; - -int main( int argc, const char **argv ) { - - const char *port = "27017"; - if ( argc != 1 ) { - if ( argc != 3 ) { - std::cout << "need to pass port as second param" << endl; - return EXIT_FAILURE; - } - port = argv[ 2 ]; - } - - Status status = client::initialize(); - if ( !status.isOK() ) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - DBClientConnection conn; - string errmsg; - if ( ! conn.connect( string( "127.0.0.1:" ) + port , errmsg ) ) { - cout << "couldn't connect : " << errmsg << endl; - return EXIT_FAILURE; - } - - const char * ns = "test.test1"; - - conn.dropCollection(ns); - - // clean up old data from any previous tests - conn.remove( ns, BSONObj() ); - verify( conn.findOne( ns , BSONObj() ).isEmpty() ); - - // test insert - conn.insert( ns ,BSON( "name" << "eliot" << "num" << 1 ) ); - verify( ! conn.findOne( ns , BSONObj() ).isEmpty() ); - - // test remove - conn.remove( ns, BSONObj() ); - verify( conn.findOne( ns , BSONObj() ).isEmpty() ); - - - // insert, findOne testing - conn.insert( ns , BSON( "name" << "eliot" << "num" << 1 ) ); - { - BSONObj res = conn.findOne( ns , BSONObj() ); - verify( strstr( res.getStringField( "name" ) , "eliot" ) ); - verify( ! strstr( res.getStringField( "name2" ) , "eliot" ) ); - verify( 1 == res.getIntField( "num" ) ); - } - - - // cursor - conn.insert( ns ,BSON( "name" << "sara" << "num" << 2 ) ); - { - auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObj() ); - int count = 0; - while ( cursor->more() ) { - count++; - BSONObj obj = cursor->next(); - } - verify( count == 2 ); - } - - { - auto_ptr<DBClientCursor> cursor = conn.query( ns , BSON( "num" << 1 ) ); - int count = 0; - while ( cursor->more() ) { - count++; - BSONObj obj = cursor->next(); - } - verify( count == 1 ); - } - - { - auto_ptr<DBClientCursor> cursor = conn.query( ns , BSON( "num" << 3 ) ); - int count = 0; - while ( cursor->more() ) { - count++; - BSONObj obj = cursor->next(); - } - verify( count == 0 ); - } - - // update - { - BSONObj res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() ); - verify( ! strstr( res.getStringField( "name2" ) , "eliot" ) ); - - BSONObj after = BSONObjBuilder().appendElements( res ).append( "name2" , "h" ).obj(); - - conn.update( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() , after ); - res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() ); - verify( ! strstr( res.getStringField( "name2" ) , "eliot" ) ); - verify( conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() ).isEmpty() ); - - conn.update( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() , after ); - res = conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() ); - verify( strstr( res.getStringField( "name" ) , "eliot" ) ); - verify( strstr( res.getStringField( "name2" ) , "h" ) ); - verify( conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() ).isEmpty() ); - - // upsert - conn.update( ns , BSONObjBuilder().append( "name" , "eliot2" ).obj() , after , 1 ); - verify( ! conn.findOne( ns , BSONObjBuilder().append( "name" , "eliot" ).obj() ).isEmpty() ); - - } - - { - // ensure index - verify( conn.ensureIndex( ns , BSON( "name" << 1 ) ) ); - verify( ! conn.ensureIndex( ns , BSON( "name" << 1 ) ) ); - } - - { - // 5 second TTL index - const char * ttlns = "test.ttltest1"; - conn.dropCollection( ttlns ); - - { - mongo::BSONObjBuilder b; - b.appendTimeT("ttltime", time(0)); - b.append("name", "foo"); - conn.insert(ttlns, b.obj()); - } - conn.ensureIndex(ttlns, BSON("ttltime" << 1), false, "", true, false, -1, 5); - verify(!conn.findOne(ttlns, BSONObjBuilder().append("name", "foo").obj()).isEmpty()); - // Sleep 66 seconds, 60 seconds for the TTL loop, 5 seconds for the TTL and 1 to ensure - sleepsecs(66); - verify(conn.findOne(ttlns, BSONObjBuilder().append("name", "foo").obj()).isEmpty()); - } - - { - // hint related tests - verify( conn.findOne(ns, "{}")["name"].str() == "sara" ); - - verify( conn.findOne(ns, "{ name : 'eliot' }")["name"].str() == "eliot" ); - verify( conn.getLastError() == "" ); - - // nonexistent index test - bool asserted = false; - try { - conn.findOne(ns, Query("{name:\"eliot\"}").hint("{foo:1}")); - } - catch ( ... ) { - asserted = true; - } - verify( asserted ); - - //existing index - verify( conn.findOne(ns, Query("{name:'eliot'}").hint("{name:1}")).hasElement("name") ); - - // run validate - verify( conn.validate( ns ) ); - } - - { - // timestamp test - - const char * tsns = "test.tstest1"; - conn.dropCollection( tsns ); - - { - mongo::BSONObjBuilder b; - b.appendTimestamp( "ts" ); - conn.insert( tsns , b.obj() ); - } - - mongo::BSONObj out = conn.findOne( tsns , mongo::BSONObj() ); - Date_t oldTime = out["ts"].timestampTime(); - unsigned int oldInc = out["ts"].timestampInc(); - - { - mongo::BSONObjBuilder b1; - b1.append( out["_id"] ); - - mongo::BSONObjBuilder b2; - b2.append( out["_id"] ); - b2.appendTimestamp( "ts" ); - - conn.update( tsns , b1.obj() , b2.obj() ); - } - - BSONObj found = conn.findOne( tsns , mongo::BSONObj() ); - cout << "old: " << out << "\nnew: " << found << endl; - verify( ( oldTime < found["ts"].timestampTime() ) || - ( oldTime == found["ts"].timestampTime() && oldInc < found["ts"].timestampInc() ) ); - - } - - { - // check that killcursors doesn't affect last error - verify( conn.getLastError().empty() ); - - BufBuilder b; - b.appendNum( (int)0 ); // reserved - b.appendNum( (int)-1 ); // invalid # of cursors triggers exception - b.appendNum( (int)-1 ); // bogus cursor id - - Message m; - m.setData( dbKillCursors, b.buf(), b.len() ); - - // say() is protected in DBClientConnection, so get superclass - static_cast< DBConnector* >( &conn )->say( m ); - - verify( conn.getLastError().empty() ); - } - - { - list<string> l = conn.getDatabaseNames(); - for ( list<string>::iterator i = l.begin(); i != l.end(); i++ ) { - cout << "db name : " << *i << endl; - } - - l = conn.getCollectionNames( "test" ); - for ( list<string>::iterator i = l.begin(); i != l.end(); i++ ) { - cout << "coll name : " << *i << endl; - } - } - - { - //Map Reduce (this mostly just tests that it compiles with all output types) - const string ns = "test.mr"; - conn.insert(ns, BSON("a" << 1)); - conn.insert(ns, BSON("a" << 1)); - - const char* map = "function() { emit(this.a, 1); }"; - const char* reduce = "function(key, values) { return Array.sum(values); }"; - - const string outcoll = ns + ".out"; - - BSONObj out; - out = conn.mapreduce(ns, map, reduce, BSONObj()); // default to inline - //MONGO_PRINT(out); - out = conn.mapreduce(ns, map, reduce, BSONObj(), outcoll); - //MONGO_PRINT(out); - out = conn.mapreduce(ns, map, reduce, BSONObj(), outcoll.c_str()); - //MONGO_PRINT(out); - out = conn.mapreduce(ns, map, reduce, BSONObj(), BSON("reduce" << outcoll)); - //MONGO_PRINT(out); - } - - { - // test timeouts - - DBClientConnection conn( true , 0 , 2 ); - if ( ! conn.connect( string( "127.0.0.1:" ) + port , errmsg ) ) { - cout << "couldn't connect : " << errmsg << endl; - throw -11; - } - conn.insert( "test.totest" , BSON( "x" << 1 ) ); - BSONObj res; - - bool gotError = false; - verify( conn.eval( "test" , "return db.totest.findOne().x" , res ) ); - try { - conn.eval( "test" , "sleep(5000); return db.totest.findOne().x" , res ); - } - catch ( std::exception& e ) { - gotError = true; - log() << e.what() << endl; - } - verify( gotError ); - // sleep so the server isn't locked anymore - sleepsecs( 4 ); - - verify( conn.eval( "test" , "return db.totest.findOne().x" , res ) ); - - - } - - cout << "client test finished!" << endl; - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/examples/first.cpp b/src/mongo/client/examples/first.cpp deleted file mode 100644 index d5537dcad25..00000000000 --- a/src/mongo/client/examples/first.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// first.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * this is a good first example of how to use mongo from c++ - */ - -#include <iostream> -#include <cstdlib> - -#include "mongo/client/dbclient.h" - -using namespace std; - -void insert( mongo::DBClientConnection & conn , const char * name , int num ) { - mongo::BSONObjBuilder obj; - obj.append( "name" , name ); - obj.append( "num" , num ); - conn.insert( "test.people" , obj.obj() ); - std::string e = conn.getLastError(); - if( !e.empty() ) { - cout << "insert failed: " << e << endl; - exit(EXIT_FAILURE); - } -} - -int main( int argc, const char **argv ) { - - const char *port = "27017"; - if ( argc != 1 ) { - if ( argc != 3 ) { - cout << "need to pass port as second param" << endl; - return EXIT_FAILURE; - } - port = argv[ 2 ]; - } - - mongo::Status status = mongo::client::initialize(); - if ( !status.isOK() ) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - mongo::DBClientConnection conn; - string errmsg; - if ( ! conn.connect( string( "127.0.0.1:" ) + port , errmsg ) ) { - cout << "couldn't connect : " << errmsg << endl; - return EXIT_FAILURE; - } - - { - // clean up old data from any previous tests - mongo::BSONObjBuilder query; - conn.remove( "test.people" , query.obj() ); - } - - insert( conn , "eliot" , 15 ); - insert( conn , "sara" , 23 ); - - { - mongo::BSONObjBuilder query; - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query( "test.people" , query.obj() ); - if (!cursor.get()) { - cout << "query failure" << endl; - return EXIT_FAILURE; - } - - cout << "using cursor" << endl; - while ( cursor->more() ) { - mongo::BSONObj obj = cursor->next(); - cout << "\t" << obj.jsonString() << endl; - } - - } - - { - mongo::BSONObjBuilder query; - query.append( "name" , "eliot" ); - mongo::BSONObj res = conn.findOne( "test.people" , query.obj() ); - cout << res.isEmpty() << "\t" << res.jsonString() << endl; - } - - { - mongo::BSONObjBuilder query; - query.append( "name" , "asd" ); - mongo::BSONObj res = conn.findOne( "test.people" , query.obj() ); - cout << res.isEmpty() << "\t" << res.jsonString() << endl; - } - - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/examples/httpClientTest.cpp b/src/mongo/client/examples/httpClientTest.cpp deleted file mode 100644 index 0608f78931a..00000000000 --- a/src/mongo/client/examples/httpClientTest.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// httpClientTest.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <iostream> - -#include "mongo/client/dbclient.h" -#include "mongo/util/net/httpclient.h" - -#ifndef verify -# define verify(x) MONGO_verify(x) -#endif - -void play( std::string url ) { - using mongo::HttpClient; - - std::cout << "[" << url << "]" << std::endl; - - HttpClient c; - HttpClient::Result r; - verify( c.get( url , &r ) == 200 ); - - HttpClient::Headers h = r.getHeaders(); - verify( h["Content-Type"].find( "text/html" ) == 0 ); - - std::cout << "\tHeaders" << std::endl; - for ( HttpClient::Headers::iterator i = h.begin() ; i != h.end(); ++i ) { - std::cout << "\t\t" << i->first << "\t" << i->second << std::endl; - } - -} - -int main( int argc, const char **argv, char **envp) { - -#ifdef MONGO_SSL - mongo::sslGlobalParams.sslMode.store(mongo::SSLGlobalParams::SSLMode_requireSSL); -#endif - - mongo::Status status = mongo::client::initialize(); - if (!status.isOK()) { - std::cout << "Failed to initialize mongodb client. " << status << std::endl; - return EXIT_FAILURE; - } - - int port = 27017; - if ( argc != 1 ) { - if ( argc != 3 ) { - std::cout << "need to pass port as second param" << std::endl; - return EXIT_FAILURE; - } - port = atoi( argv[ 2 ] ); - } - port += 1000; - - play( mongo::str::stream() << "http://localhost:" << port << "/" ); - -#ifdef MONGO_SSL - play( "https://www.mongodb.com/" ); -#endif - - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/examples/insert_demo.cpp b/src/mongo/client/examples/insert_demo.cpp deleted file mode 100644 index dc3f15d4b04..00000000000 --- a/src/mongo/client/examples/insert_demo.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - C++ client program which inserts documents in a MongoDB database. - - How to build and run: - - Using mongo_client_lib.cpp: - g++ -I .. -I ../.. insert_demo.cpp ../mongo_client_lib.cpp -lboost_thread-mt -lboost_filesystem - ./a.out -*/ - -#include <iostream> -#include "mongo/client/dbclient.h" // the mongo c++ driver - -using namespace std; -using namespace mongo; -using namespace bson; - -int main() { - - Status status = client::initialize(); - if ( !status.isOK() ) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - try { - cout << "connecting to localhost..." << endl; - DBClientConnection c; - c.connect("localhost"); - cout << "connected ok" << endl; - - bo o = BSON( "hello" << "world" ); - - cout << "inserting..." << endl; - - time_t start = time(0); - for( unsigned i = 0; i < 1000000; i++ ) { - c.insert("test.foo", o); - } - - // wait until all operations applied - cout << "getlasterror returns: \"" << c.getLastError() << '"' << endl; - - time_t done = time(0); - time_t dt = done-start; - cout << dt << " seconds " << 1000000/dt << " per second" << endl; - } - catch(DBException& e) { - cout << "caught DBException " << e.toString() << endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/examples/rs.cpp b/src/mongo/client/examples/rs.cpp deleted file mode 100644 index db82509a7e8..00000000000 --- a/src/mongo/client/examples/rs.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// rs.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * example of using replica sets from c++ - */ - -#include <iostream> -#include <vector> -#include <boost/thread/thread.hpp> - -#include "mongo/client/dbclient.h" - -using namespace mongo; -using namespace std; - -void workerThread( string collName , bool print , DBClientReplicaSet * conn ) { - - while ( true ) { - try { - conn->update( collName , BSONObj() , BSON( "$inc" << BSON( "x" << 1 ) ) , true ); - - BSONObj x = conn->findOne( collName , BSONObj() ); - - if ( print ) { - cout << x << endl; - } - - BSONObj a = conn->slaveConn().findOne( collName , BSONObj() , 0 , QueryOption_SlaveOk ); - BSONObj b = conn->findOne( collName , BSONObj() , 0 , QueryOption_SlaveOk ); - - if ( print ) { - cout << "\t A " << a << endl; - cout << "\t B " << b << endl; - } - } - catch ( std::exception& e ) { - cout << "ERROR: " << e.what() << endl; - } - sleepmillis( 10 ); - } -} - -int main( int argc , const char ** argv ) { - - unsigned nThreads = 1; - bool print = false; - bool testTimeout = false; - - for ( int i=1; i<argc; i++ ) { - if ( mongoutils::str::equals( "--threads" , argv[i] ) ) { - nThreads = atoi( argv[++i] ); - } - else if ( mongoutils::str::equals( "--print" , argv[i] ) ) { - print = true; - } - // Run a special mode to demonstrate the DBClientReplicaSet so_timeout option. - else if ( mongoutils::str::equals( "--testTimeout" , argv[i] ) ) { - testTimeout = true; - } - else { - cerr << "unknown option: " << argv[i] << endl; - return EXIT_FAILURE; - } - - } - - Status status = client::initialize(); - if ( !status.isOK() ) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - string errmsg; - ConnectionString cs = ConnectionString::parse( "foo/127.0.0.1" , errmsg ); - if ( ! cs.isValid() ) { - cout << "error parsing url: " << errmsg << endl; - return EXIT_FAILURE; - } - - DBClientReplicaSet * conn = static_cast<DBClientReplicaSet*>( cs.connect( errmsg, testTimeout ? 10 : 0 ) ); - if ( ! conn ) { - cout << "error connecting: " << errmsg << endl; - return EXIT_FAILURE; - } - - string collName = "test.rs1"; - - conn->dropCollection( collName ); - - if ( testTimeout ) { - conn->insert( collName, BSONObj() ); - try { - conn->count( collName, BSON( "$where" << "sleep(40000)" ) ); - } catch( DBException& ) { - return EXIT_SUCCESS; - } - cout << "expected socket exception" << endl; - return EXIT_FAILURE; - } - - vector<boost::shared_ptr<boost::thread> > threads; - for ( unsigned i=0; i<nThreads; i++ ) { - string errmsg; - threads.push_back( boost::shared_ptr<boost::thread>( - new boost::thread( - boost::bind( workerThread , - collName , - print , - static_cast<DBClientReplicaSet*>( cs.connect(errmsg) ) ) ) ) ); - } - - for ( unsigned i=0; i<threads.size(); i++ ) { - threads[i]->join(); - } - - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/examples/second.cpp b/src/mongo/client/examples/second.cpp deleted file mode 100644 index 87b34a482e7..00000000000 --- a/src/mongo/client/examples/second.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// second.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <iostream> - -#include "mongo/client/dbclient.h" - -using namespace std; -using namespace mongo; - -int main( int argc, const char **argv ) { - - const char *port = "27017"; - if ( argc != 1 ) { - if ( argc != 3 ) { - cout << "need to pass port as second param" << endl; - return EXIT_FAILURE; - } - port = argv[ 2 ]; - } - - Status status = client::initialize(); - if ( !status.isOK() ) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - ScopedDbConnection conn(string( "127.0.0.1:" ) + port); - - const char * ns = "test.second"; - - conn->remove( ns , BSONObj() ); - - conn->insert( ns , BSON( "name" << "eliot" << "num" << 17 ) ); - conn->insert( ns , BSON( "name" << "sara" << "num" << 24 ) ); - - std::auto_ptr<DBClientCursor> cursor = conn->query( ns , BSONObj() ); - - if (!cursor.get()) { - cout << "query failure" << endl; - return EXIT_FAILURE; - } - - cout << "using cursor" << endl; - while ( cursor->more() ) { - BSONObj obj = cursor->next(); - cout << "\t" << obj.jsonString() << endl; - } - - conn->ensureIndex( ns , BSON( "name" << 1 << "num" << -1 ) ); - - conn.done(); - - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/examples/simple_client_demo.vcxproj b/src/mongo/client/examples/simple_client_demo.vcxproj deleted file mode 100755 index 8a51c3c5744..00000000000 --- a/src/mongo/client/examples/simple_client_demo.vcxproj +++ /dev/null @@ -1,185 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win2008PlusDebug|Win32">
- <Configuration>Win2008PlusDebug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Win2008PlusRelease|Win32">
- <Configuration>Win2008PlusRelease</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{89C30BC3-2874-4F2C-B4DA-EB04E9782236}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>simple_client_demo</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup>
- <ConfigurationType>Application</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <IncludePath>..\..;..\..\..\third_party\pcre-8.30;$(IncludePath)</IncludePath>
- <LibraryPath>\boost\lib\vs2010_32;$(LibraryPath)</LibraryPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..;..\..\..\third_party\boost</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">
- <ClCompile>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <DisableSpecificWarnings>4355;4800;4267;4244</DisableSpecificWarnings>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v2\src\v2_operations.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v2\src\v2_path.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v2\src\v2_portability.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\codecvt_error_category.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\operations.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\path.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\path_traits.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\portability.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\unique_path.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\utf8_codecvt_facet.cpp">
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)filesystem_utf8_codecvt_facet.obj</ObjectFileName>
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)filesystem_utf8_codecvt_facet.obj</ObjectFileName>
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">$(IntDir)filesystem_utf8_codecvt_facet.obj</ObjectFileName>
- <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">$(IntDir)filesystem_utf8_codecvt_facet.obj</ObjectFileName>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\windows_file_codecvt.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\system\src\error_code.cpp" />
- <ClCompile Include="..\..\..\third_party\boost\libs\thread\src\win32\thread.cpp">
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\thread\src\win32\tss_dll.cpp">
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\thread\src\win32\tss_pe.cpp">
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win2008PlusDebug|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win2008PlusRelease|Win32'">BOOST_THREAD_BUILD_LIB;BOOST_ALL_NO_LIB; _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <ClCompile Include="..\mongo_client_lib.cpp" />
- <ClCompile Include="..\simple_client_demo.cpp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/src/mongo/client/examples/simple_client_demo.vcxproj.filters b/src/mongo/client/examples/simple_client_demo.vcxproj.filters deleted file mode 100755 index 17061a6186d..00000000000 --- a/src/mongo/client/examples/simple_client_demo.vcxproj.filters +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Boost">
- <UniqueIdentifier>{05b89884-0926-49fa-be75-91342d4df807}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\simple_client_demo.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\mongo_client_lib.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\thread\src\win32\thread.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\thread\src\win32\tss_dll.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\thread\src\win32\tss_pe.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\system\src\error_code.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v2\src\v2_operations.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v2\src\v2_path.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v2\src\v2_portability.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\codecvt_error_category.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\operations.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\path.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\path_traits.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\portability.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\unique_path.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\utf8_codecvt_facet.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\third_party\boost\libs\filesystem\v3\src\windows_file_codecvt.cpp">
- <Filter>Boost</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file diff --git a/src/mongo/client/examples/tail.cpp b/src/mongo/client/examples/tail.cpp deleted file mode 100644 index d6d7a4f40ce..00000000000 --- a/src/mongo/client/examples/tail.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// tail.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* example of using a tailable cursor */ - -#include "mongo/client/dbclient.h" -#include "mongo/util/goodies.h" - -using namespace mongo; - -void tail(DBClientBase& conn, const char *ns) { - BSONElement lastId = minKey.firstElement(); - Query query = Query(); - - auto_ptr<DBClientCursor> c = - conn.query(ns, query, 0, 0, 0, QueryOption_CursorTailable); - - while( 1 ) { - if( !c->more() ) { - if( c->isDead() ) { - break; // we need to requery - } - - // all data (so far) exhausted, wait for more - sleepsecs(1); - continue; - } - BSONObj o = c->next(); - lastId = o["_id"]; - cout << o.toString() << endl; - } -} diff --git a/src/mongo/client/examples/tutorial.cpp b/src/mongo/client/examples/tutorial.cpp deleted file mode 100644 index 7b5e3bf10a9..00000000000 --- a/src/mongo/client/examples/tutorial.cpp +++ /dev/null @@ -1,90 +0,0 @@ -//tutorial.cpp - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <iostream> -#include "mongo/client/dbclient.h" - -// g++ src/mongo/client/examples/tutorial.cpp -pthread -Isrc -Isrc/mongo -lmongoclient -lboost_thread-mt -lboost_system -lboost_filesystem -L[path to libmongoclient.a] -o tutorial -//g++ tutorial.cpp -L[mongo directory] -L/opt/local/lib -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_system -I/opt/local/include -o tutorial - -using namespace mongo; - -int printIfAge(DBClientConnection& c, int age) { - std::auto_ptr<DBClientCursor> cursor = c.query("tutorial.persons", QUERY( "age" << age ).sort("name") ); - if (!cursor.get()) { - cout << "query failure" << endl; - return EXIT_FAILURE; - } - - while( cursor->more() ) { - BSONObj p = cursor->next(); - cout << p.getStringField("name") << endl; - } - return EXIT_SUCCESS; -} - -int run() { - - Status status = client::initialize(); - if ( !status.isOK() ) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - DBClientConnection c; - c.connect("localhost"); //"192.168.58.1"); - cout << "connected ok" << endl; - BSONObj p = BSON( "name" << "Joe" << "age" << 33 ); - c.insert("tutorial.persons", p); - p = BSON( "name" << "Jane" << "age" << 40 ); - c.insert("tutorial.persons", p); - p = BSON( "name" << "Abe" << "age" << 33 ); - c.insert("tutorial.persons", p); - p = BSON( "name" << "Methuselah" << "age" << BSONNULL); - c.insert("tutorial.persons", p); - p = BSON( "name" << "Samantha" << "age" << 21 << "city" << "Los Angeles" << "state" << "CA" ); - c.insert("tutorial.persons", p); - - c.ensureIndex("tutorial.persons", fromjson("{age:1}")); - - cout << "count:" << c.count("tutorial.persons") << endl; - - std::auto_ptr<DBClientCursor> cursor = c.query("tutorial.persons", BSONObj()); - if (!cursor.get()) { - cout << "query failure" << endl; - return EXIT_FAILURE; - } - - while( cursor->more() ) { - cout << cursor->next().toString() << endl; - } - - cout << "\nprintifage:\n"; - return printIfAge(c, 33); -} - -int main() { - int ret = EXIT_SUCCESS; - try { - ret = run(); - } - catch( DBException &e ) { - cout << "caught " << e.what() << endl; - ret = EXIT_FAILURE; - } - return ret; -} diff --git a/src/mongo/client/examples/whereExample.cpp b/src/mongo/client/examples/whereExample.cpp deleted file mode 100644 index 23afe8fbe0e..00000000000 --- a/src/mongo/client/examples/whereExample.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// @file whereExample.cpp -// @see http://dochub.mongodb.org/core/serversidecodeexecution - -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <iostream> - -#include "mongo/client/dbclient.h" - -#ifndef verify -# define verify(x) MONGO_verify(x) -#endif - -using namespace std; -using namespace mongo; - -int main( int argc, const char **argv ) { - - const char *port = "27017"; - if ( argc != 1 ) { - if ( argc != 3 ) { - cout << "need to pass port as second param" << endl; - return EXIT_FAILURE; - } - port = argv[ 2 ]; - } - - - Status status = client::initialize(); - if ( !status.isOK() ) { - std::cout << "failed to initialize the client driver: " << status.toString() << endl; - return EXIT_FAILURE; - } - - DBClientConnection conn; - string errmsg; - if ( ! conn.connect( string( "127.0.0.1:" ) + port , errmsg ) ) { - cout << "couldn't connect : " << errmsg << endl; - return EXIT_FAILURE; - } - - const char * ns = "test.where"; - - conn.remove( ns , BSONObj() ); - - conn.insert( ns , BSON( "name" << "eliot" << "num" << 17 ) ); - conn.insert( ns , BSON( "name" << "sara" << "num" << 24 ) ); - - std::auto_ptr<DBClientCursor> cursor = conn.query( ns , BSONObj() ); - if (!cursor.get()) { - cout << "query failure" << endl; - return EXIT_FAILURE; - } - - while ( cursor->more() ) { - BSONObj obj = cursor->next(); - cout << "\t" << obj.jsonString() << endl; - } - - cout << "now using $where" << endl; - - Query q = Query("{}").where("this.name == name" , BSON( "name" << "sara" )); - - cursor = conn.query( ns , q ); - if (!cursor.get()) { - cout << "query failure" << endl; - return EXIT_FAILURE; - } - - int num = 0; - while ( cursor->more() ) { - BSONObj obj = cursor->next(); - cout << "\t" << obj.jsonString() << endl; - num++; - } - verify( num == 1 ); - - return EXIT_SUCCESS; -} diff --git a/src/mongo/client/include_bsonh_test.cpp b/src/mongo/client/include_bsonh_test.cpp deleted file mode 100644 index f31f901b54e..00000000000 --- a/src/mongo/client/include_bsonh_test.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright 2013 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <mongo/bson/bson.h> - -int main() { - return 0; -} diff --git a/src/mongo/client/include_dbclienth_test.cpp b/src/mongo/client/include_dbclienth_test.cpp deleted file mode 100644 index e3bd28a600a..00000000000 --- a/src/mongo/client/include_dbclienth_test.cpp +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright 2013 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <mongo/client/dbclient.h> - -int main() { - return 0; -} diff --git a/src/mongo/client/init.cpp b/src/mongo/client/init.cpp deleted file mode 100644 index ffdd3d5797c..00000000000 --- a/src/mongo/client/init.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2013 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mongo/platform/basic.h" - -#include "mongo/client/init.h" - -#include <cstdlib> - -#include "mongo/base/initializer.h" -#include "mongo/client/connpool.h" -#include "mongo/client/replica_set_monitor.h" -#include "mongo/util/background.h" - -namespace mongo { -namespace client { - - namespace { - void callShutdownAtExit() { - // We can't really do anything of value if this returns a non-OK status. - mongo::client::shutdown(kDefaultShutdownGracePeriodMillis); - } - } // namespace - - Status initialize(bool atexit) { - - if (atexit) { - if (std::atexit(&callShutdownAtExit) != 0) { - return Status( - ErrorCodes::InternalError, - "Failed setting client driver atexit shutdown handler"); - } - } - - Status result = runGlobalInitializers(0, NULL, NULL); - if (!result.isOK()) - return result; - - // Setup default pool parameters - mongo::pool.setName("connection pool"); - mongo::pool.setMaxPoolSize(50); - - PeriodicTask::startRunningPeriodicTasks(); - - return Status::OK(); - } - - Status shutdown(int gracePeriodMillis) { - ReplicaSetMonitor::cleanup(); - return PeriodicTask::stopRunningPeriodicTasks(gracePeriodMillis); - } - -} // namespace client -} // namespace mongo diff --git a/src/mongo/client/init.h b/src/mongo/client/init.h deleted file mode 100644 index 63614037511..00000000000 --- a/src/mongo/client/init.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2013 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "mongo/base/status.h" -#include "mongo/client/export_macros.h" - -// NOTE: These functions are only intended to be used when linking against the libmongoclient -// library. The below functions are not defined in servers like mongos or mongod, which have -// their own initialization strategy. - -namespace mongo { -namespace client { - - const int kDefaultShutdownGracePeriodMillis = 250; - - /** - * Initializes the client driver. If the 'callShutdownAtExit' parameter is true, then - * 'initialize' schedules a call to 'client::shutdown', with a grace period of - * 'kDefaultShutdownGracePeriodMillis', via std::atexit. Failure to shutdown within the - * grace period in the 'atexit' callback leads to a call to _exit. If the - * 'callShutDownAtExit' parameter is false, then it is the responsibility of the user of - * the client driver to appropriately sequence a call to 'mongo::client::shutdown' and - * respond to any failure to terminate within the grace period. Note that 'initialize' - * invokes 'runGlobalInitializers', so it is not permitted to explicitly call - * 'runGlobalInitializers' if calling 'initialize'. If a non-OK status is returned by this - * function, the error should be reported and the client driver API must not be used. - */ - MONGO_CLIENT_API Status initialize(bool callShutdownAtExit = true); - - /** - * Terminates the client driver. If the driver does not terminate within the provided - * grace period (which defaults to kDefaultShutdownGracePeriodMillis), an - * 'ExceededTimeLimit' Status will be returned, in which case it is legal to retry - * 'shutdown'. Other non-OK status values do not admit retrying the operation, and the - * failure to terminate the driver should be reported, and it may be unsafe to exit the - * process by any mechanism which causes normal destruction of static objects. - */ - MONGO_CLIENT_API Status shutdown(int gracePeriodMillis = kDefaultShutdownGracePeriodMillis); - -} // namespace client -} // namespace mongo diff --git a/src/mongo/client/simple_client_demo.cpp b/src/mongo/client/simple_client_demo.cpp deleted file mode 100644 index 3aea72c2273..00000000000 --- a/src/mongo/client/simple_client_demo.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2009 10gen Inc. - * - * 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 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* simple_client_demo.cpp - - See also : http://dochub.mongodb.org/core/cppdrivertutorial - - How to build and run: - - g++ simple_client_demo.cpp -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options - ./a.out - -*/ - -#include <iostream> -#include "dbclient.h" // the mongo c++ driver - -using namespace std; -using namespace mongo; -using namespace bson; - -int main() { - try { - cout << "connecting to localhost..." << endl; - DBClientConnection c; - c.connect("localhost"); - cout << "connected ok" << endl; - unsigned long long count = c.count("test.foo"); - cout << "count of exiting documents in collection test.foo : " << count << endl; - - bo o = BSON( "hello" << "world" ); - c.insert("test.foo", o); - - string e = c.getLastError(); - if( !e.empty() ) { - cout << "insert #1 failed: " << e << endl; - } - - // make an index with a unique key constraint - c.ensureIndex("test.foo", BSON("hello"<<1), /*unique*/true); - - c.insert("test.foo", o); // will cause a dup key error on "hello" field - cout << "we expect a dup key error here:" << endl; - cout << " " << c.getLastErrorDetailed().toString() << endl; - } - catch(DBException& e) { - cout << "caught DBException " << e.toString() << endl; - return 1; - } - - return 0; -} - diff --git a/src/mongo/dbtests/macrotests.cpp b/src/mongo/dbtests/macrotests.cpp index 32697c7f536..1e1f4ef52cf 100644 --- a/src/mongo/dbtests/macrotests.cpp +++ b/src/mongo/dbtests/macrotests.cpp @@ -58,26 +58,3 @@ #endif // gcc 4.3 -#include "mongo/client/dbclient.h" - -#ifdef malloc -# error malloc macro defined -#endif - -#ifdef verify -# error verify defined 1 -#endif - -#include "mongo/client/redef_macros.h" - -#ifndef verify -# error verify not defined 3 -#endif - -#include "mongo/client/undef_macros.h" - -#ifdef verify -# error verify defined 3 -#endif - - |