AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / Big Data / Gestión de archivos de datos Mongo
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Adds one or more documents into a collection of MongoDB database.
Ejemplo
cntMDB is mongoConnection
MyCollection is mongoCollection
MyCollection = cntMDB.Database["CRM"].Collection["MyCollection"]
MyCollection.Add("{ ""name"":""paul"", ""size"": 182 }")
gclCollection is mongoCollection
// Variable containing the documents that will be added into the database
arrDocument is array of strings
// Temporary variables
stContact is STContactInfo
sJSONBuffer is string

// Build the array of documents
stContact = [ "MOORE", "Ellen", "+33.467032032", "e.moore@windev.com" ]
Serialize(stContact, sJSONBuffer, psdJSON)
Add(arrDocument, sJSONBuffer)
stContact = [ "SMITH", "Robert", "+33.467032032", "r.smith@windev.com" ]
Serialize(stContact, sJSONBuffer, psdJSON)
Add(arrDocument, sJSONBuffer)
stContact = [ "HUDSON", "Jade", "+33.467032032", "j.hudson@windev.com" ]
Serialize(stContact, sJSONBuffer, psdJSON)
Add(arrDocument, sJSONBuffer)

// Add the three contacts in a single call
gclCollection.Add(arrDocument)
Sintaxis

Añadir un documento a una colección Ocultar los detalles

<Result> = <Collection>.Add(<Document> [, <Option>])
<Result>: booleano
  • True if the operation was performed,
  • False if a problem occurs. ErrorInfo is used to identify the error.
<Collection>: Variable de tipo mongoCollection
Name of the mongoCollection variable that represents the collection in which the document will be added.
<Document>: Tipo correspondiente al documento
Document that will be added to the collection. This document can be:
  • a document in JSON format. In this case, this parameter corresponds to a character string.
  • a document in BSON format. In this case, this parameter corresponds to a buffer.
  • a variant.
<Option>: Constante opcional de tipo Integer
Option for adding the document:
mongoWithoutValidationUsed to add the document without checking the document structure.

Añadir una lista de documentos a una colección Ocultar los detalles

<Result> = <Collection>.Add(<List of documents> [, <Options>])
<Result>: booleano
  • True if the operation was performed,
  • False if a problem occurs. ErrorInfo is used to identify the error.
<Collection>: Variable de tipo mongoCollection
Name of the mongoCollection variable that represents the collection in which the documents will be added.
<List of documents>: Array
Array of documents that will be added to the collection. These documents can correspond to:
  • a document in JSON format. In this case, this parameter corresponds to a character string.
  • a document in BSON format. In this case, this parameter corresponds to a buffer.
  • a variant.
<Options>: Constante opcional de tipo Integer
Options for adding documents:
mongoContinueIfErrorUsed to add the next document even if the previous document triggered an error.
mongoWithoutValidationUsed to add the document without checking the document structure.
Componente: wd300big.dll
Versión mínima requerida
  • Versión 25
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 21/09/2024

Señalar un error o enviar una sugerencia | Ayuda local