Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
BSON_COPY_TO_EXCLUDING_NOINIT(3)    libbson   BSON_COPY_TO_EXCLUDING_NOINIT(3)

SYNOPSIS
	  void
	  bson_copy_to_excluding_noinit	(const bson_t *src,
					 bson_t	*dst,
					 const char *first_exclude,
					 ...);

PARAMETERS
        src: A	bson_t.

        dst: A	bson_t.

        first_exclude:	The first field	name to	exclude.

DESCRIPTION
       The bson_copy_to_excluding_noinit() function shall copy all fields from
       src to dst except those specified by the	variadic, NULL terminated list
       of   keys   starting   from  first_exclude.   Works  the	 same  way  as
       bson_copy_to_excluding(), except	does  not  call	 bson_init()  on  dst.
       This    function	   should    be	   preferred	in   new   code	  over
       bson_copy_to_excluding().

       WARNING:
	  This is generally not	needed except in very special situations.

EXAMPLE
	  #include <bson/bson.h>

	  int main ()
	  {
	     bson_t bson;
	     bson_t bson2;
	     char *str;

	     bson_init (&bson);
	     bson_append_int32 (&bson, "a", 1, 1);
	     bson_append_int32 (&bson, "b", 1, 2);
	     bson_append_int32 (&bson, "c", 1, 2);

	     bson_init (&bson2);
	     bson_copy_to_excluding_noinit (&bson, &bson2, "b",	NULL);

	     str = bson_as_relaxed_extended_json (&bson2, NULL);
	     /*	Prints
	      *	{ "a" :	1, "c" : 2 }
	      */
	     printf ("%s\n", str);
	     bson_free (str);

	     bson_destroy (&bson);
	     bson_destroy (&bson2);
	  }

AUTHOR
       MongoDB,	Inc

COPYRIGHT
       2009-present, MongoDB, Inc.

1.30.2				 Apr 12, 2025 BSON_COPY_TO_EXCLUDING_NOINIT(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=bson_copy_to_excluding_noinit&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help